[Bug] Failing to use "yarn install" behind a proxy
See original GitHub issue- I’d be willing to implement a fix
Describe the bug
- yarn 2.4.0 (project-wide), yarn 1.22.1 (global install)
- debian machine
On install (yarn install) yarn2 tries to download yarn classic (nightly) even though a stable yarn classic is already installed (yarn -v => 1.22.1). That attempt is made ignoring httpProxy setting.
Our CI environment can only connect to the outside through a proxy. Thus yarn install fails.
cat /tmp/xfs-d71dd059/pack.log
Installing the project using Yarn Classic
➤ YN0000: Downloading https://nightly.yarnpkg.com/latest.js
➤ YN0001: RequestError: connect ETIMEDOUT 104.16.171.99:443
at ClientRequest.<anonymous> (/home/gaming1/buildAgent/work/34b05846fe2fe691/.yarn/releases/yarn-berry.cjs:23:31294)
at Object.onceWrapper (events.js:421:26)
at ClientRequest.emit (events.js:326:22)
at ClientRequest.e.emit (/home/gaming1/buildAgent/work/34b05846fe2fe691/.yarn/releases/yarn-berry.cjs:2:583004)
at TLSSocket.socketErrorListener (_http_client.js:428:9)
at TLSSocket.emit (events.js:314:20)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1145:16)
➤ YN0000: Failed with errors in 2m 14s
I tried downloading the file https://nightly.yarnpkg.com/latest.js
using wget (which has a proper proxy configuration and works) but running latest.js from command line only seems to start yarn install again:
./latest.js
➤ YN0000: ┌ Resolution step
...
- I don’t get why it’s trying to install yarn classic when it’s already installed
- I don’t get why the installed yarn classic should be a nightly build instead of a stable release
- I don’t get why the download attempt does not use the proxy configuration from .yarnrc
Please note that
- I am not responsible for the recent change, in our repo, from yarn classic to yarn berry
- I have no power over the security put in place, so I have to use a proxy to download something from the outside, no other option
I have no idea how to progress further, I’ve been stuck for 2 days (+ a weekend) without CI, so any help would be appreciated.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Yarn Install packages over proxy - trouble with your network
First check if 'https-proxy' exist in yarn config: yarn config list ... follows: yarn config set https-proxy http://proxy.myproxy.com:8080.
Read more >install behind proxy failed - Ghost Forum
Prove that Yarn is working through the proxy aemonge ~/t/ghost yarn install --save ghost yarn install v1.5.1 error An unexpected error ...
Read more >yarn could not resolve host registry.yarnpkg.com - Alex Hudson
Yarn fails for this CI/CD company, so they go back to npm. ... If you did somehow configure a proxy for a work...
Read more >npm packages in the Package Registry - GitLab Docs
The GitLab npm repository supports the following commands for the npm CLI ( npm ) and yarn CLI ( yarn ):. npm install...
Read more >Configuration options | Yarn - Package Manager
If true (the default on CI ), Yarn will refuse to change the installation ... Defines a proxy to use when making an...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The request is for a https url so you need to use
One of your dependencies is a git repo using Yarn 1, but since the version in use isn’t specified by the repo we fetch the latest nightly. (could probably be stable)
It’s in the external project which doesn’t have that config, we should probably fix that but as a temp workaround you can add the proxy to your global config in
~/.yarnrc.yml