E401 – Unable to authenticate, your authentication token seems to be invalid

.npmrc containing private repo credentials

  • I had similar error. It turned out that I’ve saved some credentials for private repo on .npmrc file at the root of my home folder.
  • So when I did npm install on my project, I get package-lock.json file contents appended with the private repo url. So this was the source of the error when deploying the project.
  • What I did was to temporarily remove the .npmrc, delete package-lock.json, delete node_modules and re-run npm install.
  • In my case the private repo details was not relevant for the project(so deleting .npmrc was not an issue)

Leave a Comment