Some remote npm packages return 404 when trying to resolve with Artifactory
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 of the package types.
When working with "https://registry.npmjs.org/", sometimes, the HEAD request gets a 404 response even though the package exists. 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.
Please use following steps to work around this issue (requires Artifactory version 5.5.2 and above)
- in the npm-remote repository, in the Advanced Tab, enable the "Bypass HEAD Requests" so we won't send "https://registry.npmjs.org/" HEAD requests.
- 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 return 404 for HEAD requests.