简体   繁体   中英

when I use npm start in cmd to start my react app iam getting the following error

This is the error I am getting when i do npm start after installing, Please help to resolve error, i tried reinstalling but didn't work. i also tried reinstalling google chrome as suggested from somewhere.

events.js:180
      throw er; // Unhandled 'error' event
      ^

Error: spawn cmd ENOENT
←[90m    at Process.ChildProcess._handle.onexit (internal/child_process.js:264:1
9)←[39m
←[90m    at onErrorNT (internal/child_process.js:456:16)←[39m
←[90m    at processTicksAndRejections (internal/process/task_queues.js:77:11)←[3
9m
Emitted 'error' event at:
←[90m    at Process.ChildProcess._handle.onexit (internal/child_process.js:270:1
2)←[39m
←[90m    at onErrorNT (internal/child_process.js:456:16)←[39m
←[90m    at processTicksAndRejections (internal/process/task_queues.js:77:11)←[3
9m {
  errno: ←[32m'ENOENT'←[39m,
  code: ←[32m'ENOENT'←[39m,
  syscall: ←[32m'spawn cmd'←[39m,
  path: ←[32m'cmd'←[39m,
  spawnargs: [ ←[32m'/c'←[39m, ←[32m'start'←[39m, ←[32m'""'←[39m, ←[32m'/b'←[39m
, ←[32m'http://localhost:3000/'←[39m ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! rtapp@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the rtapp@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\abc\AppData\Roaming\npm-cache\_logs\2019-07-13T11_03_11_73
6Z-debug.log

This is the log file, Iam not able to figure out the error from this file.

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'start'
1 verbose cli ]
2 info using npm@6.9.0
3 info using node@v12.6.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle rtapp@0.1.0~prestart: rtapp@0.1.0
6 info lifecycle rtapp@0.1.0~start: rtapp@0.1.0
7 verbose lifecycle rtapp@0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle rtapp@0.1.0~start: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\abc\rtapp\node_modules\.bin;C:\Users\abc\AppData\Roaming\npm;C:\Program Files\nodejs\;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Java\jdk1.7.0_25\bin;C:\Program Files (x86)\Brackets\command;C:\Program Files\PuTTY\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\nodejs\;C:\Program Files\Java\jdk1.7.0_25\bin;C:\Users\abc\AppData\Roaming\npm;C:\Users\abc\AppData\Local\Programs\Microsoft VS Code\bin
9 verbose lifecycle rtapp@0.1.0~start: CWD: C:\Users\abc\rtapp
10 silly lifecycle rtapp@0.1.0~start: Args: [ '/d /s /c', 'react-scripts start' ]
11 silly lifecycle rtapp@0.1.0~start: Returned: code: 1  signal: null
12 info lifecycle rtapp@0.1.0~start: Failed to exec start script
13 verbose stack Error: rtapp@0.1.0 start: `react-scripts start`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:203:13)
13 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:203:13)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid rtapp@0.1.0
15 verbose cwd C:\Users\abc\rtapp
16 verbose Windows_NT 6.1.7601
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v12.6.0
19 verbose npm  v6.9.0
20 error code ELIFECYCLE
21 error errno 1
22 error rtapp@0.1.0 start: `react-scripts start`
22 error Exit status 1
23 error Failed at the rtapp@0.1.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

It is failing to execute the start scripts.

Since it's an issue in events.js my first suspicion is that the process is running twice somewhere so it can't use the specified port (3000). Try closing all node instances and retrying. Or change the port number if you have something else already running on port 3000.

Or try:

rmdir /s node_modules

npm cache clean --force

npm install

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