我安装了node.js,但无法运行“ npm start”来处理React js

时间:2019-05-21 18:28:44

标签: node.js reactjs npm

我试图第一次设置react js,但是在设置了node,npm和react app之后,我运行“ npm start”命令,但出现错误。

https://www.tutorialspoint.com/reactjs/reactjs_environment_setup.htm

我尝试按照上面链接中的步骤进行安装。 但是我遇到了以下错误。

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! sample@0.1.0 start: `react-scripts start`

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the sample@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\MyPC\AppData\Roaming\npm-cache\_logs\2019-05-21T18_20_23_976Z-debug.log

1 个答案:

答案 0 :(得分:0)

您可以尝试使用此link上可用的create-react-app。这样更容易,以后您不必创建 build 脚本和其他内容时就可以避免很多麻烦。

npx create-react-app my-app
cd my-app
npm start