At some point, everyone has encountered this error code E401, and you should see the following in the command prompt or deployment window.
Step #4: npm ERR! code E401
Step #4: npm ERR! Incorrect or missing password.
So why does this happen and how to debug it?
This is happening because the npm package(s) that you are using is a private repo that requires authentication to access it but either your access token has expired and needs regeneration or client credentials are incorrect.
In order to debug this issue, look in your file structure and look for configurations that contain the authentication tokens, usually the file should be named “.npmrc”. However, it might be different depending on how you or your company set up the architecture.
Looking at the “.npmrc” file you have a rough path to investigate the issue and example of this would be like this:
@fontawsome:registry=https://npm.fontawesome.com
//npm.fontawesome.com/:_authToken=auth_token_key_here
As you can see from the example, I have a link directly to my FontAwesome account and have an authentication token because I am a paid user. Logging into my account, it seems I have gone over my limit and required me to upgrade to the next plan for more API usage or some cache my build so it does not download each time during the build.
