【发布时间】:2020-07-19 10:42:49
【问题描述】:
我想用create-react-app react-app 创建一个 React 应用程序,但出现以下错误
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
yarn add v1.13.0
info No lockfile found.
[1/4] Resolving packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
warning react-scripts > jest-environment-jsdom-fourteen > jsdom > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/314
2
info There appears to be trouble with your network connection. Retrying...
warning react-scripts > jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > request@2.88.2: request has been deprecated, see https://github.com/req
uest/request/issues/3142
warning react-scripts > resolve-url-loader > rework > css > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
warning react-scripts > resolve-url-loader > rework > css > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
warning react-scripts > jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > left-pad@1.3.0: use String.prototype.padStart()
warning react-scripts > resolve-url-loader > rework > css > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
warning react-scripts > workbox-webpack-plugin > workbox-build > strip-comments > babel-plugin-transform-object-rest-spread > babel-runtime > core-js@2.6.11: co
re-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3
.
[2/4] Fetching packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
error An unexpected error occurred: "https://registry.yarnpkg.com/@svgr/webpack/-/webpack-4.3.3.tgz: tunneling socket could not be established, cause=connect EC
ONNREFUSED 127.0.0.1:3128".
Aborting installation.
我在公司代理后面工作,但这是设置,我可以通过 npm 安装软件包,例如 npm i -g create-react-app、npm i winston 等,没有问题。
我用谷歌搜索了这个问题并尝试了类似的方法:
yarn install --network-timeout 1000000
我配置了 npm 代理和 yarn 代理,但这也不起作用。 如果我尝试这样的事情:'Yarn install' cause 'trouble with network connection' 我什至不能再使用 npm install 了。
【问题讨论】: