首页 > 解决方案 > react error-error:这可能不是 npm 的问题。上面可能有额外的日志输出

问题描述

在我的项目中,我使用的是反应。现在我要做的是将远程服务器中的项目部署到实际服务器中。我正在使用 npm 创建和启动一个项目。但是我无法构建我的项目,因为一次又一次发生以下错误,

C:\Users\User\react-tutorial>npm start

> react-tutorial@0.1.0 start C:\Users\User\react-tutorial
> react-scripts start

i 「wds」: Project is running at http://192.168.225.236/
i 「wds」: webpack output is served from
i 「wds」: Content not from webpack is served from C:\Users\User\react-tutorial\public
i 「wds」: 404s will fallback to /
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! react-tutorial@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-tutorial@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\User\AppData\Roaming\npm-cache\_logs\2020-07-27T07_26_30_467Z-debug.log

我该如何解决这个问题?

编辑:它工作我得到了答案

标签: javascripthtmlcssreactjsreact-native

解决方案


已经在这里问过了

尝试将 C:\Windows\System32 添加到全局 PATH 环境变量或清除 npm 缓存

npm cache clear --force

推荐阅读