2

In short I am facing some issues when installing node-sass via npm (https://www.npmjs.com/package/node-sass).

It seems that the https registry is the actual underlying on my side, since I am behind a ".pac"-like proxy, this happens regardless of whether I have set or not the https_proxysetting (I've also tried like https://my-proxy-address-goes-here):

ehouarn@perret C:\Users\ehouarn\Desktop\npm test
> npm config list
npm info it worked if it ends with ok
npm info using npm@5.3.0
npm info using node@v8.4.0
npm info ok
npm info it worked if it ends with ok
npm info using npm@5.3.0
npm info using node@v8.4.0
; cli configs
metrics-registry = "http://registry.npmjs.org/"
scope = ""
user-agent = "npm/5.3.0 node/v8.4.0 win32 x64"

; userconfig C:\Users\ehouarn\.npmrc
config = ""
https_proxy = "http://142.142.42.42:4242/"
loglevel = "info"
proxy = "http://142.142.42.42:4242/"
registry = "http://registry.npmjs.org/"
strict-ssl = false

; globalconfig C:\Users\ehouarn\AppData\Roaming\npm\etc\npmrc

; builtin config undefined
prefix = "C:\\Users\\ehouarn\\AppData\\Roaming\\npm"

; node bin location = C:\Program Files\nodejs\node.exe
; cwd = C:\Users\ehouarn\Desktop\npm test
; HOME = C:\Users\ehouarn
; "npm config ls -l" to show all defaults.


npm info ok

Usually I end up with:

> npm install --save node-sass
[...]
**npm ERR! code E403
npm ERR! 403 Forbidden: tar@https://registry.npmjs.org/tar/-/tar-2.2.1.tgz**
Terminate batch job (Y/N)? Y

I figured out a simple workaround by fetching with my browser the tar package and install it with npm in order to make it keep in the cache:

ehouarn@perret C:\Users\ehouarn\Desktop\npm test
> npm install tar-2.2.1.tgz
[...]
+ tar@2.2.1
added 18 packages in 3.364s
npm info ok

And "Voila", it works like a charm:

ehouarn@perret C:\Users\ehouarn\Desktop\npm test
> npm install --save node-sass
[...]
+ node-sass@4.5.3
added 164 packages in 17.786s
npm info ok

I am still a bit suspicious about why the browser can access it using the configuration, cause there is only one address of redirection indicated in the file.

Natalie Perret
  • 8,013
  • 12
  • 66
  • 129
  • 1
    Thanks! This helped solve my issue. Just to add, you can easily select a specific node-tar version from https://github.com/npm/node-tar/releases – KyleKing Dec 21 '18 at 15:46

0 Answers0