[英]whenever I try to create a react app , it shows the following error, I tried the log file also it shows the proxy error
the following error is in cmd Installing packages.以下错误在 cmd 安装包中。 This might take a couple of minutes.这可能需要几分钟时间。 Installing react, react-dom, and react-scripts with cra-template...使用 cra-template 安装 react、react-dom 和 react-scripts...
npm ERR! npm 错误! code ERR_SOCKET_TIMEOUT npm ERR!代码 ERR_SOCKET_TIMEOUT npm 错误! errno ERR_SOCKET_TIMEOUT npm ERR!.network Invalid response body while trying to fetch https://registry.npmjs.org/core-js-pure : Socket timeout npm ERR..network This is a problem related to.network connectivity. errno ERR_SOCKET_TIMEOUT npm ERR!.network Invalid response body while trying to fetch https://registry.npmjs.org/core-js-pure : Socket timeout npm ERR..network 这是与.network 连接相关的问题。 npm ERR,.network In most cases you are behind a proxy or have bad.network settings. npm ERR,.network 在大多数情况下,您在代理后面或有错误的.network 设置。 npm ERR:.network npm ERR!.network If you are behind a proxy, please make sure that the npm ERR!.network 'proxy' config is set properly. npm ERR:.network npm ERR!.network 如果您使用代理,请确保 npm ERR!.network 'proxy' 配置设置正确。 See: 'npm help config'请参阅:'npm 帮助配置'
the following error shows in log file error code ERR_SOCKET_TIMEOUT 5168 error errno ERR_SOCKET_TIMEOUT 5169 error.network Invalid response body while trying to fetch https://registry.npmjs.org/core-js-pure : Socket timeout 5170 error.network This is a problem related to.network connectivity.以下错误显示在日志文件错误代码 ERR_SOCKET_TIMEOUT 5168 error errno ERR_SOCKET_TIMEOUT 5169 error.network Invalid response body while trying to fetch https://registry.npmjs.org/core-js-pure : Socket timeout 5170 error.network 这是一个与网络连接相关的问题。 5170 error.network In most cases you are behind a proxy or have bad.network settings. 5170 error.network 在大多数情况下,您使用了代理或有错误的网络设置。 5170 error.network 5170 error.network If you are behind a proxy, please make sure that the 5170 error.network 'proxy' config is set properly. 5170 error.network 5170 error.network 如果您使用代理,请确保 5170 error.network“代理”配置设置正确。 See: 'npm help config'请参阅:'npm 帮助配置'
This error is possibly occurring due to the speed of inte.net connection or proxy configuration.由于互联网连接或代理配置的速度,可能会发生此错误。
If the inte.net connection being used is slow, you can set fetch-retry-mintimeout
and fetch-retry-maxtimeout
to higher values.如果正在使用的 inte.net 连接很慢,您可以将fetch-retry-mintimeout
和fetch-retry-maxtimeout
为更高的值。
You can check existing values for above parameters by using:您可以使用以下方法检查上述参数的现有值:
npm config get fetch-retry-mintimeout # gives fetch-retry-mintimeout value in milliseconds
npm config get fetch-retry-maxtimeout # gives fetch-retry-maxtimeout value in milliseconds
In order to set new values, use:要设置新值,请使用:
npm config set fetch-retry-mintimeout 100000 # 100s npm config set fetch-retry-maxtimeout 120000 # 120s
If the above step doesn't resolve the problem, you can also check your proxy config by:如果上述步骤不能解决问题,您还可以通过以下方式检查您的代理配置:
npm config get proxy
npm config get https-proxy
Proxy settings can be removed by using可以使用删除代理设置
npm config rm proxy
npm config rm https-proxy
Reference: npm ERR!参考: npm 错误! code ERR_SOCKET_TIMEOUT on creating new project using ng new appname 使用 ng new appname 创建新项目的代码 ERR_SOCKET_TIMEOUT
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.