Reputation: 3308
I have a jenkins setup and I installed NodeJS plugin recently. While building the project, it fails at npm install with the following error output, indicating it is unable to access internet.
npm ERR! argv "/app/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/ecp-nodejs/bin/node" "/app/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/ecp-nodejs/bin/npm" "install" "-g" "browserify"
npm ERR! node v5.10.1
npm ERR! npm v3.8.3
npm ERR! code ECONNREFUSED
npm ERR! errno ECONNREFUSED
npm ERR! syscall connect
I checked that Jenkins is running under the user "jenkins", so I have setup the npm proxy, and from terminal, I am able to install packages using that user. I have setup the proxy athentication even for root user on the system where jenkins is running.
But jenkins is unable to download packages. Is there any other setting that I should configure?
Upvotes: 1
Views: 6573
Reputation: 3308
Here is the answer, if anyone else has a similar problem. After some googling and tinkering around, I found that jenkins runs under a user called "jenkins", but without a terminal attached.
As a result, even though I su to jenkins, it doesn't change to jenkins user. The right way to do is to attach a terminal as below:
$ su -s /bin/bash jenkins
After this, I set the proxy for npm in the standard way:
$ npm config set proxy <whatever proxy>
$ npm config set https-proxy <whatever proxy>
Upvotes: 1