I'm setting up an ubuntu server that has jenkins for CI.
When I try to run a build I get failure
Question:
How can I make npm install
work from my jenkins job?
build 1:
[morningharwood] $ /bin/sh -xe /tmp/hudson8925730298288495807.sh
+ pwd
/var/lib/jenkins/workspace/morningharwood
+ ls
bower.json
client
e2e
Gruntfile.js
karma.conf.js
package.json
protractor.conf.js
server
+ npm install
/tmp/hudson8925730298288495807.sh: 5: /tmp/hudson8925730298288495807.sh: npm: not found
Build step 'Execute shell' marked build as failure
Finished: FAILURE
Jenkin build
UPDATE:
~$ pwd
/home/ubuntu
ls -a
. .bash_history .bashrc .config .gem .gnupg .node-gyp .nvm .rbenv .ssh .viminfo
.. .bash_logout .cache .dotfiles .gemrc .local .npm .profile .rvm .vim
Now that I see the .npm
+ /home/ubuntu/.npm/npm install
/tmp/hudson1456103398115324880.sh: 5: /tmp/hudson1456103398115324880.sh: /home/ubuntu/.npm/npm: not found
Build step 'Execute shell' marked build as failure
Finished: FAILURE
Configuration Script:
What happens when you run from ssh terminal?
npm WARN engine [email protected]: wanted: {"node":"~0.8 || ~0.10"} (current: {"node":"0.11.14","npm":"2.0.0"})
npm ERR! Linux 3.13.0-36-generic
npm ERR! argv "/home/ubuntu/.nvm/v0.11.14/bin/node" "/home/ubuntu/.nvm/v0.11.14/bin/npm" "install"
npm ERR! node v0.11.14
npm ERR! npm v2.0.0
npm ERR! path /var/lib/jenkins/workspace/morningharwood/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! Error: EACCES, mkdir '/var/lib/jenkins/workspace/morningharwood/node_modules'
...
So I've CHOWN the folder:
+ pwd
/var/lib/jenkins/workspace/morningharwood
sudo chown ubuntu /var/lib/jenkins/workspace/morningharwood/ -Rv
...
Ran npm install after that npm install
It was successful!
NEW PROBLEM: My build now fails when trying to clone the repository from github via jenkins.
Console log
Started by user matthew harwood
Building in workspace /var/lib/jenkins/workspace/morningharwood
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url [email protected]:matthewharwood/morningharwood.git # timeout=10
ERROR: Error fetching remote repo 'origin'
ERROR: Error fetching remote repo 'origin'
Finished: FAILURE
Showing owners:
ls -la
drwxr-xr-x 3 jenkins jenkins 4096 Dec 26 20:31 .
drwxr-xr-x 13 jenkins jenkins 4096 Dec 26 08:23 ..
drwxr-xr-x 7 ubuntu jenkins 4096 Dec 26 20:59 morningharwood
I'm setting up an ubuntu server that has jenkins for CI.
When I try to run a build I get failure
Question:
How can I make npm install
work from my jenkins job?
build 1:
[morningharwood] $ /bin/sh -xe /tmp/hudson8925730298288495807.sh
+ pwd
/var/lib/jenkins/workspace/morningharwood
+ ls
bower.json
client
e2e
Gruntfile.js
karma.conf.js
package.json
protractor.conf.js
server
+ npm install
/tmp/hudson8925730298288495807.sh: 5: /tmp/hudson8925730298288495807.sh: npm: not found
Build step 'Execute shell' marked build as failure
Finished: FAILURE
Jenkin build
UPDATE:
~$ pwd
/home/ubuntu
ls -a
. .bash_history .bashrc .config .gem .gnupg .node-gyp .nvm .rbenv .ssh .viminfo
.. .bash_logout .cache .dotfiles .gemrc .local .npm .profile .rvm .vim
Now that I see the .npm
+ /home/ubuntu/.npm/npm install
/tmp/hudson1456103398115324880.sh: 5: /tmp/hudson1456103398115324880.sh: /home/ubuntu/.npm/npm: not found
Build step 'Execute shell' marked build as failure
Finished: FAILURE
Configuration Script:
What happens when you run from ssh terminal?
npm WARN engine [email protected]: wanted: {"node":"~0.8 || ~0.10"} (current: {"node":"0.11.14","npm":"2.0.0"})
npm ERR! Linux 3.13.0-36-generic
npm ERR! argv "/home/ubuntu/.nvm/v0.11.14/bin/node" "/home/ubuntu/.nvm/v0.11.14/bin/npm" "install"
npm ERR! node v0.11.14
npm ERR! npm v2.0.0
npm ERR! path /var/lib/jenkins/workspace/morningharwood/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! Error: EACCES, mkdir '/var/lib/jenkins/workspace/morningharwood/node_modules'
...
So I've CHOWN the folder:
+ pwd
/var/lib/jenkins/workspace/morningharwood
sudo chown ubuntu /var/lib/jenkins/workspace/morningharwood/ -Rv
...
Ran npm install after that npm install
It was successful!
NEW PROBLEM: My build now fails when trying to clone the repository from github via jenkins.
Console log
Started by user matthew harwood
Building in workspace /var/lib/jenkins/workspace/morningharwood
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url [email protected]:matthewharwood/morningharwood.git # timeout=10
ERROR: Error fetching remote repo 'origin'
ERROR: Error fetching remote repo 'origin'
Finished: FAILURE
Showing owners:
ls -la
drwxr-xr-x 3 jenkins jenkins 4096 Dec 26 20:31 .
drwxr-xr-x 13 jenkins jenkins 4096 Dec 26 08:23 ..
drwxr-xr-x 7 ubuntu jenkins 4096 Dec 26 20:59 morningharwood
Share
Improve this question
edited Dec 26, 2014 at 21:01
John Abraham
asked Dec 26, 2014 at 20:20
John AbrahamJohn Abraham
18.8k36 gold badges132 silver badges240 bronze badges
2 Answers
Reset to default 11There are several problems here.
It looks like you are using node
0.11. Why? Do you need a feature from that unstable branch?
If not, I would recommend using the nodesource packaged node
modules, as described here: https://github.com/nodesource/distributions#usage-instructions
curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install -y nodejs
This will get you a good installation of node
and npm
in the global path, visible to both your ubuntu
user and the jenkins
user.
Finally, /home/ubuntu/.npm/npm
is not an executable, but is the cached version of the npm
package; /home/ubuntu/.npm
is the per-user npm download cache.
As it says:
/tmp/hudson8925730298288495807.sh: 5: /tmp/hudson8925730298288495807.sh: npm: not found
npm
isn't available in your path, so change your job to specify full path to npm
.
For example:
/usr/local/bin/npm install
or wherever npm
is located.