When the old credential/token is being used in the Npm client leads to the 401 error, meaning an invalid credential is passed by the client. If the old credential/token is used kindly replace it with the new credentials.
However, in some cases even after using a new token/credential, we might face the same 401 error code.This could occur if the client is still referring to the cached credentials for the artifact resolution for some reason.
This issue can be solved by following steps.
1. Delete the .npmrc file from the USER’s root folder.
2. Clear the Npm client cache with the following command.
npm cache clean --force
3. Then delete the package-lock.json from the project directory.
4. Further, perform the NPM login using the command referred from the SET ME UP page. Attached the screenshot for reference.
5. If the npm login is not possible, kindly copy the contents generated of the .npmrc format to the machine where the npm client is installed.
6. Perform the npm install to verify if the issue is solved.