ARTIFACTORY: How to resolve NPM E401 client errors while utilising Artifactory as a NPM registry

ARTIFACTORY: How to resolve NPM E401 client errors while utilising Artifactory as a NPM registry

AuthorFullName__c
Logeshwaran R
articleNumber
000006204
ft:sourceType
Salesforce
FirstPublishedDate
2024-10-21T09:31:39Z
lastModifiedDate
2024-10-21
VersionNumber
2
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.

image1.png

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.

image2.png

6. Perform the npm install to verify if the issue is solved.