npm install from Jenkins fails installing module hosted on bitbucket npm install from Jenkins fails installing module hosted on bitbucket jenkins jenkins

npm install from Jenkins fails installing module hosted on bitbucket


I had a similar problem in a Jenkinsfile where npm would not access a private git repo even though I could do it as the same user from the commandline. It seemed as if the .ssh/config was being ignored. I was able to work around this with the following snippet in my Jenkinsfile:

sh "eval \$(ssh-agent); ssh-add /home/tomcat/.ssh/mysshkey; npm install"


You need to generate an OAuth token in Bitbucket, look at the create consumer section. Then you can use it with https like this:

"dependencies": {    "module": "git+https://x-token-auth:{access_token}@bitbucket.org/user/module.git"}