1

We are using Nexus as our artifact repository in a corporate build environment. We have proxy repositories/registries configured for things like maven, nuget, and npm. Our jenkins build servers only have access to our local intranet, so they pull artifacts through the Nexus proxy repos. This works great for maven and nuget, but when it comes to npm I'm running into an issue.

.npmrc contains:

registry=https://nexus.local/nexus/repository/npm-official/

My package.json file contains:

"devDependencies": {
  "eslint": "^7.2.0",
  "eslint-config-airbnb-base": "^14.2.0",
  "eslint-plugin-import": "^2.21.2",
  "eslint-plugin-jquery": "^1.5.1"
}

When npm install --verbose is run from the build server, I get:

npm http 200 https://nexus.local/nexus/repository/npm-official/color-name/1.1.3
npm verb lock https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz /home/jenkins/.npm/8ac054f7--color-name-color-name-1-1-3-tgz.lock
npm verb addRemoteTarball [ 'https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz',
npm verb addRemoteTarball   'a7d0558bd89c42f795dd42328f740831ca53bc25' ]
npm info retry fetch attempt 1 at 15:30:29
npm verb fetch to= /home/jenkins/tmp/npm-21841-6pArnCsg/1593718229216-0.7411239189095795/tmp.tgz
npm http GET https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz

...snip...

npm ERR! fetch failed https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz
npm info retry will retry, error on last attempt: Error: connect ETIMEDOUT
npm ERR! fetch failed https://registry.npmjs.org/write/-/write-1.0.3.tgz
npm info retry will retry, error on last attempt: Error: connect ETIMEDOUT
npm ERR! fetch failed https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz
npm info retry will retry, error on last attempt: Error: connect ETIMEDOUT
npm ERR! fetch failed https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz
npm info retry will retry, error on last attempt: Error: connect ETIMEDOUT
npm info retry fetch attempt 2 at 15:31:41
npm verb fetch to= /home/jenkins/tmp/npm-21841-6pArnCsg/1593718228477-0.851270338287577/tmp.tgz
npm http GET https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz
npm info retry fetch attempt 2 at 15:31:41
npm verb fetch to= /home/jenkins/tmp/npm-21841-6pArnCsg/1593718228481-0.010538662783801556/tmp.tgz
npm http GET https://registry.npmjs.org/write/-/write-1.0.3.tgz
npm info retry fetch attempt 2 at 15:31:41
npm verb fetch to= /home/jenkins/tmp/npm-21841-6pArnCsg/1593718228609-0.7893481529317796/tmp.tgz
npm http GET https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz
npm info retry fetch attempt 2 at 15:31:42
npm verb fetch to= /home/jenkins/tmp/npm-21841-6pArnCsg/1593718229216-0.7411239189095795/tmp.tgz
npm http GET https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz
npm ERR! fetch failed https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz
npm info retry will retry, error on last attempt: Error: connect ETIMEDOUT
npm ERR! fetch failed https://registry.npmjs.org/write/-/write-1.0.3.tgz
npm info retry will retry, error on last attempt: Error: connect ETIMEDOUT
npm ERR! fetch failed https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz
npm info retry will retry, error on last attempt: Error: connect ETIMEDOUT
npm ERR! fetch failed https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz
npm info retry will retry, error on last attempt: Error: connect ETIMEDOUT

There is a lot more output prior to this and I'd be happy to provide it if necessary. The color-name package, as pulled from https://nexus.local/nexus/repository/npm-official/color-name/1.1.3 contains:

{
    _id: "color-name-1.1.3",
    gitHead: "cb7d4629b00fe38564f741a0779f6ad84d8007a2",
    maintainers: [{
        name: "dfcreative",
        email: "df.creative@gmail.com"
    }],
    _from: ".",
    keywords: [
        "color-name",
        "color",
        "color-keyword",
        "keyword"
    ],
    author: {
        name: "DY",
        email: "dfcreative@gmail.com"
    },
    _npmVersion: "4.6.1",
    description: "A list of color names and its values",
    dist: {
        shasum: "a7d0558bd89c42f795dd42328f740831ca53bc25",
        tarball: "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz"
    },
    _npmOperationalInternal: {
        host: "s3://npm-registry-packages",
        tmp: "tmp/color-name-1.1.3.tgz_1500157027207_0.5641644957941025"
    },
    main: "index.js",
    _shasum: "a7d0558bd89c42f795dd42328f740831ca53bc25",
    repository: {
        type: "git",
        url: "git+ssh://git@github.com/dfcreative/color-name.git"
    },
    version: "1.1.3",
    license: "MIT",
    bugs: {
        url: "https://github.com/dfcreative/color-name/issues"
    },
    _npmUser: {
        name: "dfcreative",
        email: "df.creative@gmail.com"
    },
    versions: {},
    name: "color-name",
    directories: {},
    time: {
        created: "2020-07-02T19:22:42.404Z",
        modified: "2020-07-02T19:22:42.404Z"
    },
    scripts: {
        test: "node test.js"
    },
    homepage: "https://github.com/dfcreative/color-name",
    _nodeVersion: "8.1.2"
}

That hardcoded tarball location is used to fetch the archive, and as you can see from logs above, it fails to retrieve it because this build server only has local intranet access. If I manually visit https://nexus.local/nexus/repository/npm-official/color-name/-/color-name-1.1.3.tgz in a browser, the archive is downloaded successfully.

So the npm proxy registry is working, but it seems that the tarball location is the problem. Is it possible to pull the tarball from my proxy repo? Am I missing some setting/configuration option that would cause those tarball locations to use a location relative to my defined proxy registry? It looks like more than 1 dependency of eslint is having this issue. It's not specific to just color-name.

erbrecht
  • 46
  • 5

0 Answers0