I tried to install a package with yarn earlier today and I got this
今天早些时候我试着安装了一个带有纱线的包,我得到了这个
yarn install
yarn install v1.9.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/eslint: getaddrinfo ENOTFOUND registry.yarnpkg.com registry.yarnpkg.com:443".
info If you think this is a bug, please open a bug report with the information provided in "/Users/daviddragovacz/Documents/GitHub/react- project-one/dragi/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
does anybody know how to fix this? My network seems to be okay, not slow at all.
有人知道怎么解决这个问题吗?我的网络似乎还可以,一点都不慢。
It happens with every package I tried.
我尝试过的每个套餐都会发生这种情况。
package.json
Package.json
{
"name": "dragi",
"version": "0.1.0",
"private": true,
"dependencies": {
"axios": "^0.18.0",
"prop-types": "^15.6.2",
"react": "^16.4.2",
"react-dom": "^16.4.2",
"react-redux": "^5.0.7",
"react-router": "^4.3.1",
"react-router-dom": "^4.3.1",
"react-scripts": "1.1.5",
"redux": "^4.0.0",
"redux-devtools-extension": "^2.13.5",
"redux-thunk": "^2.3.0",
"semantic-ui-css": "^2.3.3",
"semantic-ui-react": "^0.82.3",
"validator": "^10.7.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"lint": "eslint src"
},
"devDependencies": {
"eslint": "^5.5.0",
"eslint-config-airbnb": "^17.1.0",
"eslint-config-prettier": "^3.0.1",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jsx-a11y": "^6.1.1",
"eslint-plugin-prettier": "^2.6.2",
"eslint-plugin-react": "^7.11.1",
"prettier": "^1.14.2"
},
"proxy": "http://localhost:8080"
}
Also a quick note: npm i works fine - only yarn is having issues
还有一个快速说明:NPM I工作得很好-只有纱线有问题
更多回答
Can you please share your package.json as well.
请您也分享您的Package.json。
Its too bad that Yarn has no debug information what-so-ever. It would be good to see what the network issue its having is.
太糟糕了,Yarn根本没有调试信息。看看它的网络问题是什么,这将是件好事。
Using Node 10 or higher solved my 'network connection' issues
使用Node 10或更高版本解决了我的“网络连接”问题
Try clearing your cache
尝试清除您的缓存
$ yarn cache clean
$ yarn // to install dependencies, no need for "yarn install"
Approach 2
方法2
$ yarn install --network-timeout 1000000
Reference https://github.com/yarnpkg/yarn/issues/4890#issuecomment-358179301
参考https://github.com/yarnpkg/yarn/issues/4890#issuecomment-358179301
Try increasing network timeout
尝试增加网络超时
yarn install --network-timeout 1000000
found this on GitHub issues https://github.com/yarnpkg/yarn/issues/4890
在giHub问题https://github.com/yarnpkg/yarn/issues/4890上发现了这一点
I had the same issue and solved by following steps:
我也遇到了同样的问题,并通过以下步骤得到了解决:
Run the terminal command
运行终端命令
- clean npm cache
- npm cache clean --force
- set http_proxy=
- Set https_proxy=
- yarn config delete proxy
- npm config rm https-proxy
- npm config rm proxy
- Restart your terminal
- yarn
- yarn –network-timeout 100000
Restart your terminal.
重新启动您的终端。
it worked for me. #HappyCoding
这对我很管用。#快乐编码
If you are using WSL for linux just add the current ip domain in: C:\Windows\System32\drivers\etc\hosts e.g:
如果您使用的是用于Linux的WSL,只需将当前的IP域添加到:C:\WINDOWS\System32\DRIVERS\ETC\Hosts中,例如:
104.16.21.35 registry.yarnpkg.com
i had a different error, but the same network connection issue. i read through this thread: https://github.com/yarnpkg/yarn/issues/15
我有一个不同的错误,但同样的网络连接问题。我通读了这篇帖子:https://github.com/yarnpkg/yarn/issues/15
and ended up uninstalling/reinstalling node/npm which fixed my issue. maybe there's something wrong with your node installation too?
并最终卸载/重新安装节点/NPM,这解决了我的问题。也许您的节点安装也有问题?
It may be the library was originally using npm instead of yarn. In my case I had to install everything with npm instead of yarn. I removed the yarn.lock
file and then:
可能是图书馆最初使用的是NPM而不是纱线。在我的例子中,我必须用NPM而不是纱线来安装所有东西。我删除了ya n.lock文件,然后:
npm install
proxy in bash env caused my same problem.
Bash env中的代理导致了我同样的问题。
after running cmd unset HTTP_PROXY HTTPS_PROXY ALL_PROXY
, fixed this problem.
运行cmd unset HTTP_PROXY HTTPS_PROXY ALL_PROXY后,修复了此问题。
here's what worked for me:
以下是对我起作用的方法:
brew reinstall node
brew reinstall yarn
npm cache clean --force
&& yarn cache clean
&& yarn config delete proxy
&& yarn config delete https-proxy
&& yarn config delete registry
then RESTART immediately.
然后立即重新启动。
Check your internet speed / strength of connection. I had this problem while I was on a spotty public wifi. Noticed that it was a different package that threw the error each time I tried. And once I got faster / more stable internet this problem went away. (The packages were too large for my poor connection).
检查你的网速/连接强度。当我使用不稳定的公共WiFi时,我遇到了这个问题。注意到每次我尝试时都是一个不同的包抛出错误。一旦我得到了更快/更稳定的互联网,这个问题就消失了。(对于我糟糕的连接来说,包裹太大了)。
In my case, there was a hidden file .npmrc
that had the registry pointed to a location in another private network, which my network did not have access to. Once, I commented out the private network related entries in this file, yarn install
started working. Also, yarn-error.log
was generated, that had this information.
在我的例子中,有一个隐藏文件.npmrc,它的注册表指向另一个专用网络中的一个位置,而我的网络无法访问该位置。有一次,我注释掉了这个文件中与私有网络相关的条目,纱线安装开始工作。此外,还生成了包含此信息的YANINE-ERROR.LOG。
retrying few times worked out for me on similar issue.
在类似的问题上,重试几次对我来说都是有效的。
I got this as well.
我也买了这个。
I ran yarn install --no-lockfile
and it worked, so I deleted the node modules again and deleted yarn.lock
. It looks like a bug in yarn, because yarn wasn't having issues in previous versions of my application.
我运行了JAR INSTALL--no-lockfile,它起作用了,所以我再次删除了节点模块,并删除了ya n.lock。它看起来像是纱线中的一个错误,因为在我的应用程序的以前版本中,纱线没有问题。
I have tried a lot:
我已经尝试了很多:
npm clean cache
yarn clean cache
yarn config delete proxy
yarn config delete https-proxy
yarn config delete registry
yarn install --network-timeout 1000000
finally it works!
终于成功了!
Tired reinstall/install yarn but, not works, for me the problem was with the nvm cache:
重新安装/安装纱线很累,但对我来说,问题出在NVM缓存上:
nvm cache clear
After cleaning it solved the issue.
清洗后,问题就解决了。
I had the same network retrying issue when I used yarn install
, simply using yarn
worked for me or increase the timeout.
当我使用纱线安装时,我遇到了相同的网络重试问题,简单地使用纱线对我有效或增加了超时。
I had this timeout issue and the problem for me was that the image was built from an M2 MacBook. The fix was to add the --platform linux/amd64
param to the docker build command:
docker build --platform linux/amd64
我遇到了这个超时问题,对我来说,问题是镜像是从M2 MacBook构建的。修复方法是将--Platform Linux/AMD64参数添加到docker构建命令中:Docker Build--Platform Linux/AMD64
Had the same issue in Ubuntu, the solution was to disable IPv6 from network settings but also to edit the etc/hosts file, as mentioned in this Reddit post. I went with the former.
在Ubuntu中遇到了同样的问题,解决方案是在网络设置中禁用IPv6,但也要编辑etc/hosts文件,这在Reddit的这篇帖子中提到过。我选的是前者。
On a Mac, I've tried cleaning cache, reinstalling VSCode. Nothing worked for me and I'm not connected to any VPN.
在Mac电脑上,我试着清理缓存,重新安装VSCode。对我来说什么都不起作用,而且我没有连接到任何VPN。
Connecting to a VPN solved the problem.
连接到VPN解决了问题。
Even I was facing this issue, but in my case it was permission issue, thus I resolved it using
即使我也面临着这个问题,但在我的情况下,这是许可问题,因此我使用
sudo yarn install
更多回答
Still the same unfortunately.. Thanks for the tip though! :)
不幸的是还是老样子..不过,还是要谢谢你的提示!:)
Doesn't help.. In the meantime I tried to remove the lock file and node_modules folder but that didnt work either
无济于事..在此期间,我尝试删除锁定文件和NODE_MODULES文件夹,但也不起作用
Hmm this is strange. Try extending the time yarn install --network-timeout 9000000
like this. Also remove your node_modules
& lock file again. Before doing this. 3rd times the charm. :)
嗯,这很奇怪。尝试延长纱线安装时间--Network-Timeout 9000000,如下所示。还要再次删除您的node_MODULES&LOCK文件。在做这个之前。魅力的第三倍。:)
Still the same.. I checked status.npmjs.org and it says that some things are wrong at the moment and the Registry Reads have some outages now. Could this be the reason?
还是老样子..我查看了status.npmjs.org,它显示目前出现了一些问题,注册表的读数现在出现了一些中断。这可能是原因吗?
I don't think that is the reason, can you add your package.json
in the question as well. I'd like to have a look at it.
我认为这不是原因,您能在问题中加上您的Package.json吗?我想看一看。
I can find it only in yarn --help
我只能在纱线里找到它--救命
The default value is currently 30,000, i.e. 30 seconds.
当前的默认值为30,000,即30秒。
Using Node 10 or higher solved my 'network connection' issues
使用Node 10或更高版本解决了我的“网络连接”问题
unset all proxy environment variable fixed this issue, in my case. includeing above for me; $ unset http_proxy https_proxy
在我的例子中,取消设置所有代理环境变量修复了这个问题。为我包含以上内容;$unset http_Proxy https_Proxy
This was my problem. I am trying to do yarn --production
from a hotel, which results in the same error as the OP. But, copying my code to a remote server and doingyarn --production
there solved the issue.
这是我的问题。我正在试着做纱线--从一家酒店生产,这导致了与OP相同的错误。但是,将我的代码复制到远程服务器并在那里生产解决了问题。
This works for me, thank you! Are you using a SLT connection?
这对我很管用,谢谢!您是否正在使用SLT连接?
我是一名优秀的程序员,十分优秀!