Npm error 403 when downloading dependencies from jfrog artifactory

Viewed 5597

I am trying to run a job with nodejs project. One of the step is rtnpminstall which runs npm install command. rtnpminstall command is run by Artifactory plugin on Jenkins. The error says.

npm ERR! code E403
 npm ERR! 403 403 Forbidden - GET 
 https://<artifactoryurl>/artifactory/api/npm/<npm registry>/<dependency 
 name>
 npm ERR! 403 In most cases, you or one of your dependencies are requesting
 npm ERR! 403 a package version that is forbidden by your security policy.

But when I run using "npm install -g" , it works fine.

When I can click on jfrog dependency link in jenkins job log, it downloads fine

I am trying to see what could be the issue as we do not want to use -g option.

My guess is there night be no write permission on project folder on jenkins agent.

thank you

2 Answers

As Muhammed Kashif wrote in his note above -

403 error means that the user does not have permissions and mostly the Deploy/Cache permission because the dependencies are downloaded from the remote source and need to be cached.

This confusing "403" message comes from Artifactory -
not from the remote repository - because without the Deploy/Cache permissions
the user is forbidden from saving artifacts in the cache.

JFrog actually has a page describing this situation, but
only after reading Muhammed's comment I understood what they meant :)

Granting Deploy/Cache permissions to access remote repositories

In my case, I work bebind the company's proxy and also got this problem. After go throught so many workaround and sill got stuck, I figured out that I've changed my password => _auth value in .npmrc file has changed. That why I couldn't access package files

Related