yarn icon indicating copy to clipboard operation
yarn copied to clipboard

Proxy is not working but npm works well

Open gdipkf1986 opened this issue 8 years ago • 18 comments

Do you want to request a feature or report a bug? bug

What is the current behavior? keep showing There appears to be trouble with your network connection. Retrying..

If the current behavior is a bug, please provide the steps to reproduce. run yarn in root folder

What is the expected behavior? Install packages by package.json

Please mention your node.js, yarn and operating system version. Node v7.3.0 Npm 3.10.10 OS: Windows 7 Yarn: 0.18.1

.yarnrc file

registry "http://registry.npmjs.org/" https-proxy "https://domain%5Cusername:password@host:port" proxy "http://domain%5Cusername:password@host:port"

gdipkf1986 avatar Dec 21 '16 09:12 gdipkf1986

May I know is there any updates?

gdipkf1986 avatar Jan 05 '17 01:01 gdipkf1986

@Daniel15 I have the same problem.

fengcen avatar Jan 05 '17 01:01 fengcen

Same here! Also doesn't work if the proxy is specified explicitly on the command line via --proxy, --https-proxy. This is with v0.18.0.

curio77 avatar Jan 05 '17 11:01 curio77

looks like it should be released in v0.20.0: https://github.com/yarnpkg/yarn/commit/cf07f8e9ff7dd581d378d2a31efad5af8d1c4fb5

kolesnik avatar Jan 23 '17 10:01 kolesnik

Has anybody got this to work?

Still seeing the warning There appears to be trouble with your network connection. Retrying... in v.0.20.3 using proxy in .yarnrc file.

jmreicha avatar Feb 17 '17 21:02 jmreicha

Same here. I tried command line options, local .npmrc, local .yarnrc (but not foudn documentation about this) and env var. Nothing worked. Example of tested command:

./node_modules/.bin/yarn install --proxy server:port --https-proxy server:port
./node_modules/.bin/yarn install --proxy http://server:port --https-proxy http://server:port

ghostd avatar Mar 24 '17 15:03 ghostd

Reproducible using Yarn 0.24.5 on Windows 7. This is a complete dealbreaker which stops us from using Yarn at all. Anyone have an idea what to do?

csvan avatar Jun 07 '17 14:06 csvan

@curio77 @ghostd @fengcen @gdipkf1986 are you guys by any chance on Windows as well? Starting to suspect this is an OS specific issue.

csvan avatar Jun 07 '17 14:06 csvan

Nope, Linux.

curio77 avatar Jun 07 '17 14:06 curio77

FWIW we eventually solved this by not giving yarn any proxy config settings at all, but only using the proxy and https_proxy system variables. Works fine, though I have no idea why. They are identical to the corresponding config values we set for yarn.

csvan avatar Jun 16 '17 10:06 csvan

I am experiencing same issue on yarn version 1.9.2 i've set my yarn config to https-proxy http://localhost:3182 but I am still getting same message

waleedahmed3045 avatar Aug 03 '18 15:08 waleedahmed3045

Same problem here, any updates?

ywmail avatar Sep 14 '18 10:09 ywmail

+1

ganonbit avatar Dec 04 '19 18:12 ganonbit

have the same issue

BlueCog avatar Jan 08 '20 13:01 BlueCog

Anybody had any luck with this? Also have this issue.

sarensw avatar Nov 17 '20 11:11 sarensw

Same issue here. npm operations work fine with our corporate proxy (also using an internal repository). yarn operations fail with:

Error: https://our-internal-repository/api/npm/npm-virtual/some-package: tunneling socket could not be established, statusCode=502
      at ClientRequest.onConnect (/usr/local/Cellar/yarn/1.21.1/libexec/lib/cli.js:152140:19)
      at Object.onceWrapper (events.js:428:26)
      at ClientRequest.emit (events.js:321:20)
      at Socket.socketOnData (_http_client.js:509:11)
      at Socket.emit (events.js:321:20)
      at addChunk (_stream_readable.js:297:12)
      at readableAddChunk (_stream_readable.js:273:9)
      at Socket.Readable.push (_stream_readable.js:214:10)
      at TCP.onStreamRead (internal/stream_base_commons.js:186:23)

Yarn version 1.21.1.

This prevents teams using yarn in many enterprise environments, I'm surprised this issue has been open for so long without comment.

fotijr avatar Mar 12 '21 18:03 fotijr

I'm also having the same issue here - i have tried mutiple things already but the outcome is still the same npm works fine with the proxy settings

but yarn always gives me the same output

e.g.

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 Couldn't find package "@babel/helper-validator-identifier@^7.15.7" required by "@babel/highlight@^7.16.0" on the "npm" registry.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Error: Couldn't find package "@babel/helper-split-export-declaration@^7.16.0" required by "@babel/helper-module-transforms@^7.16.0" on the "npm" registry.
    at MessageError.ExtendableBuiltin (/usr/local/lib/node_modules/yarn/lib/cli.js:243:66)
    at new MessageError (/usr/local/lib/node_modules/yarn/lib/cli.js:272:123)
    at PackageRequest.<anonymous> (/usr/local/lib/node_modules/yarn/lib/cli.js:38988:17)
    at Generator.throw (<anonymous>)
    at step (/usr/local/lib/node_modules/yarn/lib/cli.js:92:30)
    at /usr/local/lib/node_modules/yarn/lib/cli.js:105:13
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)

using cntlm

yarn config set https-proxy http://localhost:3128
yarn config set http-proxy http://localhost:3128
yarn config set strict-ssl false

it really is annoying because some projects rely heavily on yarn and cannot be used without it. hopefully there is somebody how can support on this issue

jakubikan avatar Nov 23 '21 13:11 jakubikan

I am also using cntlm, what worked for me with yarn 4.1.1 is

yarn config set httpProxy http://localhost:3128
yarn config set httpsProxy http://localhost:3128

sirishkumar avatar Apr 16 '24 12:04 sirishkumar