npm install 不使用 .npmrc 注册表设置

Dán*_*Kis 5 npm jenkins

我在代理后面工作,因此我在 nexus 中使用本地 npm 注册表。我有一个 .npmrc 配置,其中包含 jenkins 中的注册表设置:

/var/jenkins_home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/nodejs-default/bin/node "/var/jenkins_home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/nodejs-default/bin/npm" config get registry
https://nexus/repository/npm-all/
Run Code Online (Sandbox Code Playgroud)

当我想运行 npm install 时,出现以下错误:

/var/jenkins_home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/nodejs-default/bin/node "/var/jenkins_home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/nodejs-default/bin/npm" "install"
npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t git://github.com/ariya/esprima.git
npm ERR!
npm ERR! fatal: unable to connect to github.com:
npm ERR! github.com[0: 192.30.253.113]: errno=Connection refused
npm ERR! github.com[1: 192.30.253.112]: errno=Connection refused
npm ERR!
npm ERR!
npm ERR! exited with error code: 128

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-03-29T13_46_39_199Z-debug.log
Run Code Online (Sandbox Code Playgroud)

为什么它要连接到 github.com 而不是 Nexus?这是第二次运行 npm install,第一次安装从 nexus 下载一些软件包,但是当它想要下载 ariya/esprima 时,它会停止并出现相同的错误。

我的 package.json:(这是一个旧版本)

{
  "name": "my-application",
  "version": "1.0.0",
  "devDependencies": {
    "autonumeric": "^1.9.39",
    "bootbox": "^4.4.0",
    "bootstrap": "^3.3.5",
    "bootstrap-datepicker": "^1.4.1",
    "bootstrap-tour": "^0.10.1",
    "chalk": "^1.0.0",
    "file-sync-cmp": "^0.1.1",
    "font-awesome": "^4.4.0",
    "grunt": "^0.4.5",
    "grunt-auto-install": "^0.2.4",
    "grunt-contrib-clean": "^0.6.0",
    "grunt-contrib-copy": "^0.8.0",
    "grunt-replace": "^0.10.2",
    "grunt-ts": "^4.2.0",
    "grunt-tsd": "^0.1.0",
    "i18next": "^1.9.0",
    "i18next-client": "^1.9.0",
    "jquery": "^2.1.4",
    "jquery.cookie": "^1.4.1",
    "jquery.scrollto": "^2.1.1",
    "knockout": "^3.3.0",
    "moment": "^2.10.3",
    "qunit": "^0.7.6",
    "require": "^2.4.18",
    "requirejs": "^2.1.18",
    "typeahead.js": "^0.11.1"
  },
  "dependencies": {
    "grunt-cli": "^1.2.0"
  }
}
Run Code Online (Sandbox Code Playgroud)