16
votes

I'm trying to proxy node-sass and other npm libraries through Nexus, but run into problems when a post install step of node-sass tries to pull the file https://github.com/sass/node-sass/releases/download/v3.10.1/linux-x64-48_binding.node from github. I'm behind a corporate firewall, so my only option is having Nexus proxy all the files I need.

Is it possible to add just this individual file to Nexus somehow, so that it's able to proxy that and deliver it whenever a request is sent to https://github.com/sass/node-sass/releases/download/v3.10.1/linux-x64-48_binding.node?

2

2 Answers

8
votes

After some digging the best solution I can think of is to do this:

https://github.com/sass/node-sass/blob/9c6933f4eb5c9572e1cdc577d500469c14411908/lib/extensions.js#L121-L147

You can use the --sass-binary-site argument or environment variable (or value in your .npmrc, lol) to override where it will reach out for these packages, where you could potentially clone the repo internally so that you have them all: https://github.com/sass/node-sass-binaries

More info on this is available on these two issues:

As well, there is a lot of information on this available here (towards the bottom) from us friendly folks at Sonatype: https://support.sonatype.com/hc/en-us/articles/213465048-Why-does-npm-client-need-access-to-URLs-other-than-my-private-registry-

0
votes

I'm using a RAW hosted repository on Nexus and added this line into my npmrc file: sass-binary-site=https://url-to-private.nexus/repository/raw-repository-name/node-sass

Note: I am uploading to that raw repository e.g. to the folder /node-sass/v4.11.0/

Didn't find a solution to just proxy the whole GitHub repo yet.