【问题标题】:Create-react-app not working at "npm start" even though correct npm/node version [duplicate]即使 npm/node 版本正确,Create-react-app 也无法在“npm start”工作 [重复]
【发布时间】:2020-06-07 02:15:25
【问题描述】:
  1. 我正在学习对此tutorial 的反应。我收到一个关于没有启动脚本的错误,使用我的文本编辑器添加到 package.json 文件中。现在我真的不知道如何解决我的新错误。
  2. 更新了我的 package-json 文件,卸载并重新安装了 create-react-app,创建了新的 react-app 文件夹,读取了堆栈溢出。使用“npx react-scripts start”手动启动它。
  3. 我的 npm -v (6.7.0) 和节点 -v (12.16.0)

    react-app的文件目录树

    • node_modules
      • 使用 create-react-app 创建文件夹时添加的文件夹列表
    • 公开
      • favicon.ico
      • index.html
      • manifest.json
    • src

      • index.js
    • .gitignore
    • package.json
    • package-lock.json
    • README.md

错误:

circulating@CLAPP-T460-22 MINGW64 ~/Desktop/react-app (master)
$ npm start

> react-app@1.1.0 start C:\Users\circulating\Desktop\react-app
> react-scripts start


i 「wds」: Project is running at http://192.168.1.16/
i 「wds」: webpack output is served from
i 「wds」: Content not from webpack is served from C:\Users\circulating\Desktop\re                                                                                                                act-app\public
i 「wds」: 404s will fallback to /
Starting the development server...

events.js:287
      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-app@1.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-app@1.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\circulating\AppData\Roaming\npm-cache\_logs\2020-06-07T01_                                                                                                                12_36_919Z-debug.log

【问题讨论】:

    标签: node.js reactjs npm create-react-app


    【解决方案1】:

    将 C:\Windows\System32 添加到全局 PATH 环境变量中。

    使用不同的 react 脚本版本重新安装您的 npm。只需在命令中转到您的文件夹并像这样重新安装: npm install react-scripts@2.1.8 npm 开始

    【讨论】:

      猜你喜欢
      • 2019-03-18
      • 2020-09-23
      • 2019-11-19
      • 1970-01-01
      • 2020-07-11
      • 2021-02-01
      • 2017-02-18
      • 2021-01-03
      • 2018-09-06
      相关资源
      最近更新 更多