Home > Mobile >  npm ECONNREFUSED with or without proxy trying to install sass-embedded
npm ECONNREFUSED with or without proxy trying to install sass-embedded

Time:08-16

I am trying to install sass-embedded with this command:

npm init -y
npm install sass-embedded --save-dev

I am behind a corporate proxy. Setting it in the npm config gives me the error below. If I delete the proxy npm is super slow but after ~20 minutes I also get the same error:

npm verb stack Error: command failed
npm verb stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\promise-spawn\lib\index.js:63:27)
npm verb stack     at ChildProcess.emit (node:events:513:28)
npm verb stack     at maybeClose (node:internal/child_process:1091:16)
npm verb stack     at ChildProcess._handle.onexit (node:internal/child_process:302:5)
npm verb pkgid [email protected]
npm verb cwd C:\Users\ME\Desktop\bla
npm verb Windows_NT 10.0.19042
npm verb node v18.7.0
npm verb npm  v8.15.0
pm ERR! code 1
npm ERR! path C:\Users\ME\Desktop\bla\node_modules\sass-embedded
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c C:\Users\ME\AppData\Local\Temp\postinstall-bb50f570.cmd
npm ERR! Downloading dart-sass-embedded release asset.
npm ERR! FetchError: request to https://github.com/sass/dart-sass-embedded/releases/download/1.54.4/sass_embedded-1.54.4-windows-x64.zip failed, reason: connect ECONNREFUSED 140.82.121.3:443
npm ERR!     at ClientRequest.<anonymous> (C:\Users\ME\Desktop\bla\node_modules\minipass-fetch\lib\index.js:130:14)
npm ERR!     at ClientRequest.emit (node:events:513:28)
npm ERR!     at TLSSocket.socketErrorListener (node:_http_client:481:9)
npm ERR!     at TLSSocket.emit (node:events:525:35)
npm ERR!     at emitErrorNT (node:internal/streams/destroy:151:8)
npm ERR!     at emitErrorCloseNT (node:internal/streams/destroy:116:3)
npm ERR!     at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
npm ERR!   code: 'ECONNREFUSED',
npm ERR!   errno: 'ECONNREFUSED',
npm ERR!   syscall: 'connect',
npm ERR!   address: '140.82.121.3',
npm ERR!   port: 443,
npm ERR!   type: 'system'
npm ERR! }

Other packages install just fine with a proxy set. It seems like npm is trying to access https://github.com and somehow the connection gets refused ...

Installing gulp for example has no errors what so ever.

Also, running this on my personal computer without a proxy runs just fine...it seems like the proxy settings are ignore when trying to grab the sass_embedded-1.54.4-windows-x64.zip from github releases.

CodePudding user response:

Got it working like this

set PROXY=http://10.20.30.40:80
set HTTPS_PROXY=http://10.20.30.40:80
npm install sass-embedded --save-dev

or via the Windows environment varibales GUI.

The http:// part is necessary.

The package uses fetch-make-happen which seems to not use the npm config proxy and needs an extra invitation :)

  • Related