如何解决尝试使用“ npm start”启动React应用时遇到ELIFECYCLE错误
尝试启动我的React应用时遇到以下错误。
events.js:174
throw er; // Unhandled 'error' event
^ Error: spawn powershell.exe 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!
/root/.npm/_logs/2020-09-15T14_43_41_420Z-debug.log
我在Windows 10系统上的VSCODE中使用bash终端。
可能相关的其他信息:
- 用于安装create-react-app的命令->
npm install create-react-app
- 用于创建新的React应用的命令->
npx create-react-app my_app
- NPM版本->
6.14.4
请注意,关于React我是一个完整的初学者。将不胜感激对此提供的任何投入。谢谢!
解决方法
您可以提供更多信息吗?您在使用yarn start
吗?
还有一个注意事项-如果使用npx
,则不必安装create-react-app
。该答案解释了npx
和npm
-https://stackoverflow.com/questions/50605219/difference-between-npx-and-npm#:~:text=npx%20is%20a%20npm%20package,it%20in%20a%20single%20step之间的区别。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。