How to Proxy node-sass Packages Through Artifactory

AuthorFullName__c
Daniel Poterman
articleNumber
000004805
FirstPublishedDate
2020-05-21T13:05:19Z
lastModifiedDate
2025-05-14

How to Proxy node-sass Packages Through Artifactory

Many organizations use the node-sass packages in their day-to-day operations. Some will even save and cache these packages for future reference. If you'd like to download and cache such packages to your Artifactory server, you'll first need to have node.js and npm installed on your local server. Then, do the following:

1. Create an npm remote repository and set the following URL: https://registry.npmjs.org
User-added image
2. In your Artifactory UI, navigate to Artifacts > npm-remote > Set Me Up button:User-added image

User-added image
3. Run the following commands:

npm login --registry=http://<SERVER_NAME>:<PORT>/artifactory/api/npm/npmjs-npm-local/ --auth-type=web

4. Create a generic remote repository, which proxies the following URL: https://github.com/sass/node-sass/releases/download
5. On the repository's Advanced configuration page, scroll down and tick the Bypass HEAD Requests checkbox (to allow Artifactory to send GET requests without first issuing a HEAD request).
User-added image

6. Finally, edit the ~/.npmrc file. Set the sass_binary_site parameter to the generic remote repository you just created. For example:

sass_binary_site=http://<username>:<API Key>@<SERVER_NAME>:<PORT>/artifactory/<your-generic-remote-repository>

Note: Your API Key can be found by navigating to Artifacts > your-generic-remote-repository > Set Me Up button. Insert your password and the API Key will be shown below. 

Additionally, be aware that these instructions are referring to the local user, ~/.npmrc file, not the project's .npmrc file.