在尝试在 jenkins 中构建代码时,我遇到了一些关于 NPM update
的错误。
package.json
文件中的所有依赖项已存在于私有(private)存储库中。
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.
最佳答案
正如您所提到的,您使用私有(private)存储库,但错误表明您从公共(public)存储库获得依赖项:https://registry.npmjs.org ,我猜你的网络需要代理才能访问公共(public)网络,而你没有为npm设置代理。
选项 1) 在 npm 命令行中指定 npm 注册表:
npm install --registry=您的私有(private)存储库网址
选项 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
关于node.js - Jenkins - NPM 更新失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48443638/