Why am I getting 404 for some npm packages?

Subject

Some remote npm packages return 404 when trying to resolve with Artifactory
 

Affected Versions

All versions 
 

Description

As for today, Artifactory before sending a GET request to resolve a package from a remote endpoint, sends a HEAD request to this endpoint, once it gets 200 for the HEAD request, it will send a follow up GET request. This is how Artifactory works with all remote repositories regardless the package types.

When working with "https://registry.npmjs.org/" , sometimes, the HEAD request get a 404 response even though the package exist. This causes Artifactory to not send a GET request to resolve the package and it is failing the entire request.

As "https://registry.npmjs.org/" does not send 404 for all HEAD requests,, some packages get installed successfully and some fail.

Note! Issue was reported to npm registry on their Github repository.
 

Resolution

Please use following steps to work around this issue (requires Artifactory version 5.5.2 and above)

  1. in the npm-remote repository, in the Advanced Tab, enable the "Bypass HEAD Requests" so we wont send "https://registry.npmjs.org/" HEAD requests.
  2. Once you enable it, From the UI -> click on Artifacts, right click on the npm-repository name -> Zap cache.

Then we will be able to resolve the packages that returns 404 for HEAD requests.