[英]Timeout error when trying to use npx create-react-app
When I try to run this, I get this error:当我尝试运行它时,出现此错误:
npm ERR! Response timeout while trying to fetch https://registry.npmjs.org/@typescript-eslint%2fparser (over 30000ms)
This is what happens in the log:这是日志中发生的事情:
205 warn notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
206 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS: darwin
206 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch: any
206 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS: win32
206 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: x64
207 verbose type body-timeout
208 verbose stack FetchError: Response timeout while trying to fetch https://registry.npmjs.org/@typescript-eslint%2fparser (over 30000ms)
208 verbose stack at Timeout._onTimeout (C:\Program Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\body.js:189:16)
208 verbose stack at listOnTimeout (internal/timers.js:549:17)
208 verbose stack at processTimers (internal/timers.js:492:7)
209 verbose cwd C:\Users\Acc\mern-todo-app
210 verbose Windows_NT 10.0.18362
211 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--save" "--save-exact" "--loglevel" "error" "react" "react-dom" "react-scripts" "cra-template"
212 verbose node v12.16.2
213 verbose npm v6.14.4
214 error Response timeout while trying to fetch https://registry.npmjs.org/@typescript-eslint%2fparser (over 30000ms)
215 verbose exit [ 1, true ]
I'm pretty new to this so I have no idea what's happening.我对此很陌生,所以我不知道发生了什么。
I also faced similar error while creating react app for the first time after installing NodeJS.在安装 NodeJS 后第一次创建 React 应用程序时,我也遇到了类似的错误。 It was resolved by running below commands in sequence:
它是通过依次运行以下命令来解决的:
npm cache clean --force
npm install create-react-app
npx create-react-app my-app
Try clearing cache and rerun the command.尝试清除缓存并重新运行该命令。
$ npm cache clean --force
I also faced similar issue and was able to fix the issue with following commands:我也遇到了类似的问题,并且能够使用以下命令解决该问题:
npx clear-npx-cache
npx create-react-app my-app
Maybe, someone has my case.也许,有人有我的案子。 In my case the error was reporting a line like this:
npm install --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.
在我的情况下,错误报告如下一行:
npm install --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.
I just installed those packages one-by-one, by typing:我只是通过键入以下内容一个一个地安装了这些软件包:
npm install --save --save-exact --loglevel error react
npm install --save --save-exact --loglevel error react-dom
npm install --save --save-exact --loglevel error react-scripts
npm install --save --save-exact --loglevel error cra-template
After that, I just run npx create-react-app appname
and it worked.之后,我只运行
npx create-react-app appname
就可以了。
I also faced this issue, I tried with this code by adding timeout into it and it worked like a charm.我也遇到了这个问题,我尝试通过在其中添加超时来使用此代码,它就像一个魅力。
npx create-react-app my-app -timeout=60000
Here 60000 is 60 seconds.这里 60000 是 60 秒。 You can increase the time as per your choice.
您可以根据自己的选择增加时间。
Use -timeout flag npm create react app -timeout=1000
.使用 -timeout 标志
npm create react app -timeout=1000
。 Note => timeout flag take tge value in mili second注意 => 超时标志以毫秒为单位取 tge 值
I wasn't able to solve it using clear cache, delete proxy etc. So, I tried yarn and it worked like a charm!我无法使用清除缓存、删除代理等解决它。所以,我尝试了纱线,它就像一个魅力!
yarn create react-app project-name
If you run it on Windows, try to open shell windiw as an admin, had the same error and it helped me.如果您在 Windows 上运行它,请尝试以管理员身份打开 shell 窗口,遇到同样的错误,它对我有帮助。
I also faced similar error while creating react app for the first time after installing NodeJS.我在安装 NodeJS 后第一次创建 React 应用程序时也遇到了类似的错误。 It was not solved by running below commands in sequence:
通过依次运行以下命令无法解决问题:
npm cache clean --force
npm install create-react-app
npx create-react-app my-app
I also faced this issue again again, I tried with this code by adding timeout into 12000000 and it worked like a charm.我也再次遇到了这个问题,我尝试通过将超时添加到 12000000 来使用这段代码,它就像一个魅力。
I also encountered the timeout problem while trying to install react app by using npx create-react-app app-name.我在尝试使用 npx create-react-app app-name 安装 React 应用程序时也遇到了超时问题。 The solution is to uninstall node, then go to node js official site to download a new one, then install and try npx create-react-app my-app.
解决方法是卸载node,然后去node js官网下载一个新的,然后安装试试npx create-react-app my-app。 It will work perfectly.
它会完美地工作。
I'm getting this issue after giving lots of command its and working and while creating app after few seconds lots of errors found If you are behind a proxy, please make sure that the network 'proxy' config is set properly.我在给出大量命令并工作后遇到此问题,并且在几秒钟后创建应用程序时发现大量错误如果您在代理后面,请确保网络“代理”配置设置正确。 See: 'npm help config'
请参阅:'npm 帮助配置'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.