尝试使用“ npm start”启动React应用时遇到ELIFECYCLE错误

时间:2020-09-15 15:32:04

标签: reactjs npm npx

尝试启动我的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我是一个完整的初学者。将不胜感激对此提供的任何投入。谢谢!

1 个答案:

答案 0 :(得分:0)

您可以提供更多信息吗?您在使用yarn start吗?

还有一个注意事项-如果使用npx,则不必安装create-react-app。该答案解释了npxnpm-https://stackoverflow.com/questions/50605219/difference-between-npx-and-npm#:~:text=npx%20is%20a%20npm%20package,it%20in%20a%20single%20step之间的区别。

相关问题