开发者问题收集

如何解决 React js 中创建应用程序时出错的问题

2020-05-10
174

我已经在电脑上安装了 react js。我尝试通过 create-react-app react-app 在 cmd 中创建一个 react 应用,但出现了以下错误:

C:\Users\Ahnaaf Al Rafee>create-react-app react-app

Creating a new React app in C:\Users\Ahnaaf Al Rafee\react-app.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...

npm ERR! Response timeout while trying to fetch https://registry.npmjs.org/@typescript-eslint%2fparser (over 30000ms)

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Ahnaaf Al Rafee\AppData\Roaming\npm-cache\_logs\2020-05-10T18_28_37_892Z-debug.log

Aborting installation.
  npm install --save --save-exact --loglevel error react react-dom react-scripts has failed.

Deleting generated file... package.json
Deleting react-app / from C:\Users\Ahnaaf Al Rafee
Done.
2个回答

您的互联网连接似乎很慢。请尝试增加 .npmrc 中的超时时间。

Sumit
2020-05-10

试试这个,它可能会有帮助

npm cache clean --force
Wahab Shah
2020-05-10