我刚刚创建了一个react js项目。然后,我运行“ npm start”以运行项目。出现此错误,我现在在这里停留了1天。我已经有其他reactJS项目。所有其他项目都出现此错误。这就是为什么我在新项目中尝试过的原因。所以我通过创建新项目来确认。错误不在我的项目中。
我已经尝试过了。
错误是
C:\Suranga\ReactJS\JMSL\my_app>npm start
> my_app@0.1.0 start C:\Suranga\ReactJS\JMSL\my_app
> react-scripts start
> Starting the development server...
events.js:174
throw er; // Unhandled 'error' event
^
Error: spawn cmd ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my_app@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
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! C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2019-09-10T15_10_01_727Z-debug.log
C:\Suranga\ReactJS\JMSL\my_app>
答案 0 :(得分:0)
首先请确保您位于使用create-react-app创建的正确应用程序文件夹中。否则,尝试在文件夹中运行npm install
。
答案 1 :(得分:0)
出于存档目的,这是OP报告的the solution。
降级为反应脚本2.1.8。
create-react-app my-app
cd my-app
npm install react-scripts@2.1.8
npm start
答案 2 :(得分:0)
对于其他人仍然有同样的问题。对于这些项目,以前的解决方案并不成功。最终,我按照以下步骤进行操作。
1)为Windows安装Chocolatey(https://chocolatey.org/)
2)使用choco安装npm(“ choco install nodejs-latest ”)
3)npm start