简体   繁体   中英

getting error when run command 'npm start' after 'npx create-react-app my-app' in creating a react project

node v12.18.2 npm 6.14.7

getting same error every time when all is done and i run 'npm start'. it is not a npm error as error message said.

I have run 'npm uninstall -g create-react-app' to uninstall the package. to resolve this I have removed node and install it min 3-4 times.

error message -

Starting the development server...
events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: spawn cmd ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn cmd',
  path: 'cmd',
  spawnargs: [ '/s', '/c', 'start', '""', '/b', '"http://localhost:3000/"' ]
}
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.```




package.json - 

```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:\\Users\\Mayur\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'start'
1 verbose cli ]
2 info using npm@6.14.7
3 info using node@v12.18.2
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle my-app@0.1.0~prestart: my-app@0.1.0
6 info lifecycle my-app@0.1.0~start: my-app@0.1.0
7 verbose lifecycle my-app@0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle my-app@0.1.0~start: PATH: C:\Users\Mayur\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;F:\mayur\AST\react\react exercise\my-app\node_modules\.bin;C:\Program Files\nodejs\;C:\Windows\System32\cmd.exe;D:\jdk-12.0.2_windows-x64_bin\jdk-12.0.2\bin;C:\Users\Mayur\AppData\Local\atom\bin;C:\Users\Mayur\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Mayur\AppData\Roaming\npm;C:\Program Files\Microsoft VS Code\bin
9 verbose lifecycle my-app@0.1.0~start: CWD: F:\mayur\AST\react\react exercise\my-app
10 silly lifecycle my-app@0.1.0~start: Args: [ '/d /s /c', 'react-scripts start' ]
11 silly lifecycle my-app@0.1.0~start: Returned: code: 1  signal: null
12 info lifecycle my-app@0.1.0~start: Failed to exec start script
13 verbose stack Error: my-app@0.1.0 start: `react-scripts start`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Users\Mayur\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:315:20)
13 verbose stack     at ChildProcess.<anonymous> (C:\Users\Mayur\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:315:20)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid my-app@0.1.0
15 verbose cwd F:\mayur\AST\react\react exercise\my-app
16 verbose Windows_NT 6.1.7601
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Mayur\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v12.18.2
19 verbose npm  v6.14.7
20 error code ELIFECYCLE
21 error errno 1
22 error my-app@0.1.0 start: `react-scripts start`
22 error Exit status 1
23 error Failed at the my-app@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 ]

please somebody help me to resolve this error.

after getting error it gives 15 vulnerabilities,it suggests to run 'npm audit' or 'npm-audit-fix'. I tried 'npm-audit-fix' and it suggests to do manual review on vulnerabilities. I tried 'npm audit' and it gives -



  Path            node-modules > request > hawk



  More info       https://npmjs.com/advisories/77





  Moderate        Remote Memory Exposure



  Package         request



  Patched in      >=2.68.0



  Dependency of   node-modules



  Path            node-modules > request



  More info       https://npmjs.com/advisories/309





  Moderate        Regular Expression Denial of Service



  Package         mime



  Patched in      >= 1.4.1 < 2.0.0 || >= 2.0.3



  Dependency of   node-modules



  Path            node-modules > request > form-data > mime



  More info       https://npmjs.com/advisories/535





  Moderate        Regular Expression Denial of Service



  Package         mime



  Patched in      >= 1.4.1 < 2.0.0 || >= 2.0.3



  Dependency of   node-modules



  Path            node-modules > request > mime



  More info       https://npmjs.com/advisories/535





  Moderate        Prototype Pollution



  Package         hoek



  Patched in      > 4.2.0 < 5.0.0 || >= 5.0.3



  Dependency of   node-modules



  Path            node-modules > request > hawk > boom > hoek



  More info       https://npmjs.com/advisories/566





  Moderate        Prototype Pollution



  Package         hoek



  Patched in      > 4.2.0 < 5.0.0 || >= 5.0.3



  Dependency of   node-modules



  Path            node-modules > request > hawk > cryptiles > boom > hoek



  More info       https://npmjs.com/advisories/566





  Moderate        Prototype Pollution



  Package         hoek



  Patched in      > 4.2.0 < 5.0.0 || >= 5.0.3



  Dependency of   node-modules



  Path            node-modules > request > hawk > hoek



  More info       https://npmjs.com/advisories/566





  Moderate        Prototype Pollution



  Package         hoek



  Patched in      > 4.2.0 < 5.0.0 || >= 5.0.3



  Dependency of   node-modules



  Path            node-modules > request > hawk > sntp > hoek



  More info       https://npmjs.com/advisories/566





  Moderate        Memory Exposure



  Package         tunnel-agent



  Patched in      >=0.6.0



  Dependency of   node-modules



  Path            node-modules > request > tunnel-agent



  More info       https://npmjs.com/advisories/598





  Low             Prototype Pollution



  Package         minimist



  Patched in      >=0.2.1 <1.0.0 || >=1.2.3



  Dependency of   node-modules



  Path            node-modules > optimist > minimist



  More info       https://npmjs.com/advisories/1179





  High            Insufficient Entropy



  Package         cryptiles



  Patched in      >=4.1.2



  Dependency of   node-modules



  Path            node-modules > request > hawk > cryptiles



  More info       https://npmjs.com/advisories/1464





  Low             Prototype Pollution



  Package         yargs-parser



  Patched in      >=13.1.2 <14.0.0 || >=15.0.1 <16.0.0 || >=18.1.2



  Dependency of   react-scripts



  Path            react-scripts > webpack-dev-server > yargs > yargs-parser



  More info       https://npmjs.com/advisories/1500



found 15 vulnerabilities (2 low, 9 moderate, 4 high) in 1720 scanned packages
  15 vulnerabilities require manual review. See the full report for details.

Try to add C:\Windows\System32 to global PATH environment variable. It should work.

If not work,

delete node_modules, package-lock.json

Then run npm cache clear --force and 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