'Jenkins NPM private registry returns 401

Locally, I am able to successfully authorize and pull modules from my private Nexus registry (.npmrc file). However on Jenkins I get

error An unexpected error occurred: "https://myprivaterepo.com/myprivatemodule.tgz: Request failed \"401 Unauthorized\"".

When I run npm whoami on Jenkins it returns a valid user. npm config ls prints valid configuration as well.

The problem started to occur when I changed myprivaterepo url (we've migrated it). Is there something I don't know (ie. I have to logout/login again or there's some cache in Jenkins)??

Thanks in advance!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source