所以我正在尝试学习React。在今天之前从来没有用过,上了几门课。我按照reactjs.org上的说明设置了一个单页面应用程序。我一直在运行npm start,却遇到了一个错误。所以,我恼火地做了一些研究,更新了npm和node.js (npm现在是v5.6.0,node现在是9.4.0),仍然得到同样的错误。现在我找不到任何答案,完全不知道为什么npm start不能工作。
Jonathans-MBP:src jonathankuhl$ npm start
> my-app@0.1.0 start /Users/jonathankuhl/Documents/HTML:CSS Practice/react test/my-app
> react-scripts start
sh: react-scripts: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! my-app@0.1.0 start: `react-scripts start`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the my-app@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/jonathankuhl/.npm/_logs/2018-01-26T19_59_09_179Z-debug.log
Jonathans-MBP:src jonathankuhl$ cd ./
Jonathans-MBP:src jonathankuhl$ ls
App.css index.js
App.js logo.svg
App.test.js registerServiceWorker.js
index.css
Jonathans-MBP:src jonathankuhl$ cd ..
Jonathans-MBP:my-app jonathankuhl$ ls
README.md package-lock.json public
node_modules package.json src
Jonathans-MBP:my-app jonathankuhl$ 任何帮助都将不胜感激。
发布于 2018-01-27 04:32:29
看起来你没有安装react-script,在npm start之前执行npm install,或者如果这不能修复它,执行npm install react-scripts --save来安装它们,它应该可以修复它。
https://stackoverflow.com/questions/48469080
复制相似问题