How to configure Artifactory proxy an npm package feed in VSTS?

Balaji Satish
2019-07-04 13:19

Subject

Artifactory as a Universal Repository Manager supports all the software packaging formats. We can also configure Artifactory to proxy an npm feed in VSTS. An npm feed is a repository or a registry that is compatible with the npm client.

Resolution

For Artifactory to proxy npm feed in VSTS, we would be required to create an npm type remote repository and point the URL to the VSTS feed.

 

By default, Azure DevOps uses Personal Access token for authentication. Artifactory supports multiple means of authentication, which includes Basic Authentication.

In order to successfully authenticate Artifactory with remote npm VSTS feed, it is required to create alternate credentials in the Azure DevOps. This is because Artifactory currently does not support PAT authentication. These alternate credentials should be passed in the remote authentication block under the Advanced tab of the remote repository settings. Also, select the Bypass Head Request option in the same Advanced tab of the remote repository settings.

 

 

The test connection would still return "Connection failed: Error 404: Not Found", this is because of HEAD requests not being accepted by VSTS. But the packages still will be resolved from your remote VSTS npm feed.

Once this setup is completed, for the npm client to work with Artifactory, we should set the default npm registry in the .npmrc to the above created Artifactory npm remote repository.  

By doing this, all the packages available in your npm feed or private registry in VSTS will be accessible from Artifactory.

Please note this setup was tested in Artifactory version 6.10 and above.