安装React项目时遇到问题

时间:2020-07-19 09:13:06

标签: reactjs npm project

yarn add v1.22.4
[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...
info There appears to be trouble with your network connection. Retrying...
error An unexpected error occurred: "https://registry.yarnpkg.com/react: tunneling socket could not be established, cause=connect ECONNREFUSED 127.0.0.1:80".
info If you think this is a bug, please open a bug report with the information provided in "D:\\React\\resort\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Aborting installation.
 yarnpkg add --exact react react-dom react-scripts cra-template --cwd D:\React\resort has failed.

Deleting generated file... package.json
Deleting generated file... yarn.lock
Done.

您能帮我弄清楚我尝试安装时发生了什么吗?

1 个答案:

答案 0 :(得分:0)

Ciao,根据this的讨论,yarn proxy存在问题。有人通过以下方式解决了问题:

$ yarn config set proxy http://username:password@host:port
$ yarn config set https-proxy http://username:password@host:port

,但我看到此解决方案并不适用于所有人。 可能的解决方案:尝试在讨论中建议的这种方式或使用npm

npm i react