Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

290
Views
npm ci in Dockerfile throws 401 not authorized when using node:16 as base image

For some reason, NPM requires authentication when running npm ci in a docker build. I never had this issue before. What is happening?

This is my Dockerfile:

FROM node:16 as builder
WORKDIR /app
COPY package*.json ./
RUN npm ci

This is the error I am receiving:

 > [4/4] RUN npm ci:
#8 1.357 npm notice 
#8 1.357 npm notice New minor version of npm available! 7.21.1 -> 7.23.0
#8 1.357 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v7.23.0>
#8 1.357 npm notice Run `npm install -g npm@7.23.0` to update!
#8 1.357 npm notice 
#8 1.358 npm ERR! code E401
#8 1.359 npm ERR! Unable to authenticate, your authentication token seems to be invalid.
#8 1.359 npm ERR! To correct this please trying logging in again with:
#8 1.359 npm ERR!     npm login
#8 1.370 
#8 1.370 npm ERR! A complete log of this run can be found in:
#8 1.370 npm ERR!     /root/.npm/_logs/2021-09-11T11_55_11_040Z-debug.log

This is my package.json:

{
  "name": "warranty-ui",
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "serve": "vite preview"
  },
  "devDependencies": {
    "@sveltejs/vite-plugin-svelte": "^1.0.0-next.11",
    "sass": "^1.39.2",
    "svelte": "^3.37.0",
    "vite": "^2.5.4"
  },
  "dependencies": {
    "bulma": "^0.9.3",
    "i18next": "^20.6.1",
    "msal": "^1.4.12"
  }
}

Edit: I found out that when using node:14 as base image. The error doesn't come.

FROM node:14 as builder

This works for me, but probably not for everyone.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!