简体   繁体   中英

Error when I try run a React App with npm start command

I create a new React Project and I try to start it with the command npm start but I have 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)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! primera-app@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the primera-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\Felipe\AppData\Roaming\npm-cache\_logs\2019-08-11T15_55_25_058Z-debug.log

I try a lot of things but nothing works.

I had the same problem on Windows about two months ago. I solved it downgrading react-scripts to the version 2.1.8 . To do so:

  1. Delete node_modules directory.
  2. Edit package.json file to downgrade react-scripts . It should look like this: "react-scripts": "2.1.8" .
  3. Go to the project folder: cd my-app .
  4. Run npm install .
  5. Run npm start .

If this doesn't work, please check your system variables on Windows and make sure C:\\Windows\\System32\\ variable is set as shown here or here .

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