【问题标题】:npm start showing error after create-react-appnpm 在 create-react-app 后开始显示错误
【发布时间】:2021-01-06 00:15:09
【问题描述】:

我一直在尝试创建一个新的 react 应用程序,但无法 npm 启动它。 我无法理解错误消息。希望有人知道。 我昨天也尝试了 github deploy(如果有帮助的话)。 我在 npm start 后得到的错误是:-

D:\myportfolio>npm start

> myportfolio@0.1.0 start D:\myportfolio
> react-scripts start

i 「wds」: Project is running at http://192.168.43.213/
i 「wds」: webpack output is served from
i 「wds」: Content not from webpack is served from D:\myportfolio\public
i 「wds」: 404s will fallback to /
Starting the development server...

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

Error: spawn powershell 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 powershell',
  path: 'powershell',
  spawnargs: [
    '-NoProfile',
    '-NonInteractive',
    '–ExecutionPolicy',
    'Bypass',
    '-EncodedCommand',
    'UwB0AGEAcgB0ACAAIgBgACIAaAB0AHQAcAA6AC8ALwBsAG8AYwBhAGwAaABvAHMAdAA6ADMAMAAwADAAYAAiACIA'
  ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! myportfolio@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the myportfolio@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-09-19T06_53_55_730Z-debug.log

【问题讨论】:

  • 删除你的 node_modules 文件夹,运行 npm start 然后试一试

标签: reactjs web npm cmd npm-start


【解决方案1】:

我最近遇到了这个确切的问题,这个针对 Windows 的修复对我有用:

  1. 转到控制面板
  2. 进入系统和安全 -> 系统 -> 高级系统设置
  3. 签出名为“高级”的选项卡,然后转到“环境变量”
  4. 单击路径,在路径末尾添加“C:\Windows\System32”进行编辑,用分号分隔。例如 (AppData\Roaming\npm;C:\Windows\System32)。

最后重新启动您的计算机以获得良好的效果。在无数次尝试重新安装节点模块之后,这是唯一对我有用的修复。

【讨论】:

    猜你喜欢
    • 2020-07-11
    • 2017-02-18
    • 1970-01-01
    • 2019-05-07
    • 2021-02-27
    • 2021-04-28
    • 1970-01-01
    • 2021-06-17
    • 2020-04-18
    相关资源
    最近更新 更多