简体   繁体   中英

Why npm start is getting error for react project?

I'm trying to start a React application, with npm but I get this error:

      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)

I'm using node version 10.16.3 and npm 6.13.6. I've cleaned npm cache and install npm again, but I'm getting always the same error

I suggest doing these three steps:

  1. npm install -g npm@latest to update npm because it is sometimes buggy.
  2. rm -rf node_modules to remove the existing modules.
  3. npm install to re-install the project dependencies.

the problem is fixed, i've installed another version of "react-scripts", because the actuel version is not stable, so i use to overwrite it with the given version, so use this command to install:

npm install react-scripts@2.1.8

Once the installation is completed your can run your reac app:

npm start

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM