Search code examples
npmartifactory

Some package give 404 not found when run npm install package from jfrog Artifactory


when I want to install packages from JFrog artifactory, JFrog returns 404 not found for the same package. For example, if you curl for one package from the JFrog URL Continuously, for some request return package but for one requests gave 404 not found.

You can use this two options for testing:

npm -i your_package

or

curl -v your_package_url_from_jfrog

Solution

  • Artifactory sends the HEAD requests before sending a GET request to fetch the packages. However, when working with NPM public registries the HEAD request can sometimes trigger a 404 error even though the package exists. Therefore, it will not send the GET request to fetch the package.

    In order to overcome this we can enable the Bypass Head requests option under the Advanced section of the repository settings and then perform a Zap cache on the remote cache repository and try to fetch the package again.

    More details on how to overcome this behavior are mentioned in this Knowledge Base article.