【问题标题】:Jenkins - NPM update failedJenkins - NPM 更新失败
【发布时间】:2018-01-25 13:08:48
【问题描述】:

我在尝试在 jenkins 中构建代码时遇到了一些关于 NPM update 的错误。

package.json 文件中的所有依赖项都已存在于私有仓库中。

Running npm update in /var/www-etc/etc/releases/source/2018012599999

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.

【问题讨论】:

  • 显示你的 package.json,从给定的错误来看,你似乎有依赖关系:etc,npm 无法从 https://registry.npmjs.org 获取它

标签: node.js jenkins npm build


【解决方案1】:

正如你所提到的,你使用私人仓库,但错误说你从公共仓库获得依赖:https://registry.npmjs.org,我猜你的网络需要代理才能访问公共网络,而你没有为 npm 设置代理。

选项 1) 在 npm 命令行中指定 npm 注册表:
npm install --registry=your prive repo url

选项 2) 使用项目级别的 .npmrc 文件
1)在您的nodejs项目文件夹(package.json所在的位置)下创建.npmrc文件
2)在.npmrc文件中添加以下内容

registry = your private repo url
strict-ssl=false
// if need proxy to access private repo, comment out below two lines
// http-proxy = proxy address
// https-proxy= proxy address

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-01-20
    • 2017-11-02
    • 1970-01-01
    • 2017-10-04
    • 1970-01-01
    • 1970-01-01
    • 2015-02-24
    • 2016-01-06
    相关资源
    最近更新 更多