node.js - Jenkins - NPM 更新失败

标签 node.js jenkins npm build

在尝试在 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/

相关文章:

node.js - Snap.svg 可以仅在服务器端与 Node.js 一起使用吗? (不是通过浏览器)

node.js - Phantomjscloud 无法与 aws lambda nodejs 一起使用

jenkins - 有没有办法将当前的 BUILD_NUMBER 从 Jenkins 构建传递到 Gradle 守护进程?

scala - SBT 构建对于无需清理的常规部署来说是否可靠?

javascript - 我如何在请求模块中进行response.write

node.js - npm install firebase 失败

node.js - sudo npm 失败,env : node: No such file or directory

node.js - 用于 Node 项目的 docker-compose 在 Windows 上找不到 package.json

node.js - Mongoose:从 2 个集合获取数据

node.js - 从 jenkins 无限加载 sudo npm