繁体   English   中英

我正在尝试下载React js,但是又一次又一次出现此错误?

[英]I am trying to download React js, but I am getting this error again and again?

我正在使用npm下载react js,但是一次又一次出现此错误。 任何可以给我解决方案。我已经尝试了多次,但仍然给我同样的错误。

C:\\ react \\ todo> npm开始

> todo@0.1.0 start C:\react\todo
> react-scripts start
Starting the development server...

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

Error: spawn cmd ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:77:11)
Emitted 'error' event at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:77:11) {
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn cmd',
  path: 'cmd',
  spawnargs: [ '/c', 'start', '""', '/b', 'http://localhost:3000/' ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! todo@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the todo@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\HAROON & ABDULREHMAN\AppData\Roaming\npm-cache\_logs\2019-08-28T21_27_54_711Z-debug.log

经过研究,我发现了这一点。

我(tylerlaberge)也遇到了这个确切的问题,发现它仅在react-scripts@3.0.0中存在,降级到react-scripts@2.1.8解决了该问题,而无需弄乱环境变量。

create-react-app my-app
cd my-app
npm install react-scripts@2.1.8
npm start

https://github.com/facebook/create-react-app/issues/6985#issuecomment-490319841

您应该使用npx create-react-app appname该名称来自react docs https://reactjs.org/docs/create-a-new-react-app.html 当我使用npm create-react-app时,我经常遇到很多问题,当我说使用npx时,它们都消失了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM