npm install private scope - 404 even if .npmrc in project root directory

What I Wanted to Do

I want to build a docker image but earlier no issue with the below details but for 2days I am facing issue.

What Happened Instead

I have a valid .npmrc file in the project root directory.

//registry.npmjs.org/:_authToken=${NPM_TOKEN}
registry=https://registry.npmjs.org/
progress=true
loglevel=${NPM_LOG_LEVEL}

I am tried to build my docker image during npm install throws 404.

docker build -t my-node-app . --build-arg NPM_TOKEN=58XXXX-XXXX-XXXX-XXXX-XXXXXX --build-arg NPM_LOG_LEVEL=info

npm ERR! 404 Not Found - GET https://registry.npmjs.org/@sisprod%2Fkuehelper - Not found

Platform Info

$ RUN npm --version
{ 'my-node-app': '1.0.0',
  npm: '6.11.1',
  ares: '1.15.0',
  cldr: '33.1',
  http_parser: '2.8.0',
  icu: '62.1',
  modules: '64',
  napi: '3',
  nghttp2: '1.34.0',
  node: '10.15.3',
  openssl: '1.1.0j',
  tz: '2018e',
  unicode: '11.0',
  uv: '1.23.2',
  v8: '6.8.275.32-node.51',
  zlib: '1.2.11' 
}

$ RUN node -p process.platform
linux

Can you currently access the private registry from outside docker using this .npmrc file?

Also in case you were not aware, it takes some care to avoid secrets passed this way being visible in the container.

Warning: It is not recommended to use build-time variables for passing secrets like github keys, user credentials etc. Build-time variable values are visible to any user of the image with the docker history command.

@shadowspawn:
No. outside of the docker also is not installing using .npmrc

//registry.npmjs.org/:_authToken=XXXXXXX-XXXX-XXXX-XXXX-XXXXXX
registry=https://registry.npmjs.org/
progress=true
loglevel=info

There are not any issues reported on the npmjs status page.

I suggest you confirm the token is still listed as valid:

https://docs.npmjs.com/creating-and-viewing-authentication-tokens

@shadowspawn:
Yes. issues with my token.

I used my system root .npmrc token which is not working so I have logged on once again and created new token that token i used in .npmrc file now it is working fine both outside docker and within docker build process.

Issue has been resolved.

Thanks

1 Like