简体   繁体   English

如何解决此问题 npm 错误以安装我的反应应用程序?

[英]how can I fix this problem npm error to install my react app?

npm ERR! npm 错误! code ERR_SOCKET_TIMEOUT npm ERR!代码 ERR_SOCKET_TIMEOUT npm ERR! errno ERR_SOCKET_TIMEOUT npm ERR! errno ERR_SOCKET_TIMEOUT npm ERR! network Invalid response body while trying to fetch https://registry.npmjs.org/html-webpack-plugin : Socket timeout npm ERR!网络尝试获取https://registry.npmjs.org/html-webpack-plugin时响应正文无效:套接字超时 npm ERR! network This is a problem related to network connectivity.网络 这是与网络连接有关的问题。 npm ERR! npm 错误! network In most cases you are behind a proxy or have bad network settings.网络 在大多数情况下,您使用代理服务器或网络设置错误。 npm ERR! npm 错误! network npm ERR!网络 npm 错误! network If you are behind a proxy, please make sure that the npm ERR!网络 如果您在代理后面,请确保 npm ERR! network 'proxy' config is set properly.网络“代理”配置设置正确。 See: 'npm help config'请参阅:'npm 帮助配置'

npm ERR! npm 错误! A complete log of this run can be found in:可以在以下位置找到此运行的完整日志:

Try clear the cache and install again尝试清除缓存并重新安装

npm cache clear --force npm 缓存清除 --force

npm install npm 安装

you can try use yarn too.. because it uses backup sources.您也可以尝试使用yarn .. 因为它使用备份源。

i recommande to work with yarn npm install --global yarn yarn create react-app my-app我建议使用 yarn npm install --global yarn yarn create react-app my-app

else you need to clean the cache npm cache clean --force // clean the cache npm cache verify //verify the cache否则需要清理缓存 npm cache clean --force //清理缓存 npm cache verify //验证缓存

npx create-react-app my-app // create you react app npm i npx create-react-app my-app // 创建你的反应应用 npm i

I wanted to run an existing react project too, and I got the same errors while running: npm install我也想运行一个现有的 react 项目,运行时遇到同样的错误: npm install

I had node version 16.15.0 and I upgraded to version 18.1.0,我有节点版本 16.15.0 并升级到版本 18.1.0,

I run npm install and everything was finally fine.我运行npm install ,一切都好起来了。

Check this out: https://github.com/facebook/create-react-app/issues/12330看看这个: https ://github.com/facebook/create-react-app/issues/12330

You may also revert to node version 16.4.16 and see if that works for you.您也可以恢复到节点版本 16.4.16,看看是否适合您。 How to downgrade Node version 如何降级 Node 版本

My friend I was facing the same problem as me and I found the solution I hope it works out for you First Step : Download Latest Version Of Node Js Second Step : Download Npm Latest Version (Latest Version Important) by npm install -g npm@latest in Cmd Or Terminal Visual Studio Code我的朋友,我遇到了和我一样的问题,我找到了解决方案,希望对你有用第一步:下载 Node Js 的最新版本第二步:通过npm install -g npm@下载 Npm 最新版本(最新版本重要)最新的 Cmd 或终端 Visual Studio 代码

Then然后

Check Of in Cmd Or Terminal Visual Studio Code Any you Want It's Up To You node -v => Should Display Number Represent Node Version npm -v => Should Display Number Represent Npm Version在 Cmd 或终端 Visual Studio 代码中检查任何你想要的由你决定 node -v => 应该显示数字代表节点版本npm -v => 应该显示数字代表 Npm 版本

Then然后

Write (( npx create-react-app app-name ) => Any Name You Want) I hope with all my heart that this solution will work写 (( npx create-react-app app-name ) => Any Name You Want) 我衷心希望这个解决方案能够奏效

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

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