You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Jenkins构建时NPM update失败求助:依赖已在私有仓库却报404

Fixing NPM Update E404 Error in Jenkins Build

Hey there, let's break down this issue and get your Jenkins build back on track. First, let's recap the error you're encountering to make sure we're aligned:

npm ERR! Linux 3.13.0-139-generic
npm ERR! argv "/var/www-etc/.nvm/versions/node/v4.2.2/bin/node" "/var/www-notify/.nvm/versions/node/v4.2.2/bin/npm" "update"
npm ERR! node v4.2.2
npm ERR! npm v2.14.7
npm ERR! code E404
npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/etc
npm ERR! 404
npm ERR! 404 'etc' is not in the npm registry.

The core problem here is that npm is trying to fetch a package named etc from the official public npm registry, but that package doesn't exist there. Since you mentioned all your dependencies live in a private registry, here are the most likely fixes to resolve this:

1. Check for typos or incorrect package references in package.json

First, take a close look at the package.json file in /var/www-etc/etc/releases/source/2018012599999. It's possible you have a typo in a dependency name (like accidentally writing "etc": "^1.0.0" instead of your actual private package name) or a hidden dependency that's referencing etc without you noticing.

  • Open the package.json and scan both dependencies and devDependencies sections for any mention of etc.
  • If you find it, correct the package name to match the one hosted in your private registry, or remove it if it's an accidental entry.

2. Ensure npm is configured to use your private registry

Even if you've set up the private registry elsewhere, the Jenkins environment might still default to the public registry. Let's verify and fix that:

  • Run this command in your Jenkins build step (or directly on the server in the target directory) to check the current registry setting:
    npm config get registry
    
  • If the output is https://registry.npmjs.org/, set it to your private registry with:
    npm config set registry https://your-private-registry-url/
    
  • Alternatively, add a publishConfig section directly to your package.json to enforce the private registry for this project:
    "publishConfig": {
      "registry": "https://your-private-registry-url/"
    }
    

3. Verify the etc package exists in your private registry (if it's intentional)

If etc is actually a package you host in your private registry, log into your registry's admin interface and confirm:

  • The package etc exists and has the exact version specified in your package.json.
  • The Jenkins server has proper permissions to access this package (check for authentication tokens, IP whitelisting, or access control lists if your registry uses them).

Once you address one of these issues, re-run the npm update step in Jenkins—it should now pull dependencies from your private registry instead of hitting the public one.

内容的提问来源于stack exchange,提问作者MohitKgec

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 04:10:43