React 项目npm ERR! A complete log of this run can be found in: npm ERR! ..._logs\2020-04-...debug.log

报错:

e:\StudyFile\kaikeba\works\React专题\react-router>npm start

> [email protected] start e:\StudyFile\kaikeba\works\React专题\react-router
> react-scripts start

Starting the development server...

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

Error: spawn cmd ENOENT
?[90m    at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)?[39m
?[90m    at onErrorNT (internal/child_process.js:469:16)?[39m
?[90m    at processTicksAndRejections (internal/process/task_queues.js:84:21)?[39m
Emitted 'error' event on ChildProcess instance at:
?[90m    at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)?[39m
?[90m    at onErrorNT (internal/child_process.js:469:16)?[39m
?[90m    at processTicksAndRejections (internal/process/task_queues.js:84:21)?[39m {
  errno: ?[32m'ENOENT'?[39m,
  code: ?[32m'ENOENT'?[39m,
  syscall: ?[32m'spawn cmd'?[39m,
  path: ?[32m'cmd'?[39m,
  spawnargs: [ ?[32m'/s'?[39m, ?[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! [email protected] start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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!     D:\NodeJs\node_cache\_logs\2020-04-03T08_59_34_174Z-debug.log

问题原因:电脑使用的不是admin用户,不能直接读取路径C:\Windows\System32(netstat -ano这些命令都不可用,只能以管理员身份登录才能用),所以问题在于用户权限问题。

解决:在环境变量中path中加上  ;C:\Windows\System32  即可

你可能感兴趣的:(React,前端,JS高级,react)