简体   繁体   中英

Jenkins fails to install npm packages

Something weird is happening with my Jenkins install.

------ 1 ------

Here, I have a two build steps, consisting of two shell scripts:

First: npm install jspm

Second: npm install browser-sync

Checking out Revision e05c2140a0142d6223b9c38c2fe70dd1b4f8dbc6 (refs/remotes/origin/master)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f e05c2140a0142d6223b9c38c2fe70dd1b4f8dbc6
 > git rev-list e05c2140a0142d6223b9c38c2fe70dd1b4f8dbc6 # timeout=10
[workspace] $ /bin/sh -xe /tmp/hudson205250999430849146.sh
+ npm install jspm
npm WARN dxx-app@1.0.0 No repository field.
[workspace] $ /bin/sh -xe /tmp/hudson4116699777377548210.sh
+ npm install browser-sync
Killed
Build step 'Execute shell' marked build as failure
Finished: FAILURE

------ 2 ------ If I run only one build step, running the following shell script, it breaks the jenkins service alltogether:

Shell script: npm install browser-sync

Checking out Revision e05c2140a0142d6223b9c38c2fe70dd1b4f8dbc6 (refs/remotes/origin/master)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f e05c2140a0142d6223b9c38c2fe70dd1b4f8dbc6
 > git rev-list e05c2140a0142d6223b9c38c2fe70dd1b4f8dbc6 # timeout=10
[workspace] $ /bin/sh -xe /tmp/hudson3323153925792902879.sh
+ npm install browser-sync
502 Bad Gateway
nginx/1.4.6 (Ubuntu)

------ 3 ------ If I run the following shell script, it works: npm install jspm

Checking out Revision e05c2140a0142d6223b9c38c2fe70dd1b4f8dbc6 (refs/remotes/origin/master)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f e05c2140a0142d6223b9c38c2fe70dd1b4f8dbc6
 > git rev-list e05c2140a0142d6223b9c38c2fe70dd1b4f8dbc6 # timeout=10
[workspace] $ /bin/sh -xe /tmp/hudson4962873221523396658.sh
+ npm install jspm
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.5
npm WARN dxx-app@1.0.0 No repository field.
[ArtifactDeployer] - Starting deployment from the build step ...
[ArtifactDeployer] - 0 file(s) have been copied from the '/var/lib/jenkins/jobs/dxx-app/workspace' to 'home/danield/dxx-app'.
[ArtifactDeployer] - Stopping deployment from the build step ...
[workspace] $ /bin/sh -xe /tmp/hudson1033340373247995718.sh
+ chmod -R g+rwx,u+rwx /home/danield/dxx-app
Finished: SUCCESS

What could cause these weird issues?

Also, jenkins does not report any errors in it's logs, but I found something in the work space, the npm debug log:

18917 silly install bufferutil@1.2.1 /var/lib/jenkins/jobs/dxx-app/workspace/node_modules/.staging/bufferutil-db56e030b10e52f326f069d2efef3ab7
18918 info lifecycle bufferutil@1.2.1~install: bufferutil@1.2.1
18919 verbose lifecycle bufferutil@1.2.1~install: unsafe-perm in lifecycle true
18920 verbose lifecycle bufferutil@1.2.1~install: PATH: /var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/NodeJS_0.12.8/lib/node_modules/npm/bin/node-gyp-bin:/var/lib/jenkins/jobs/dxx-app/workspace/node_modules/bufferutil/node_modules/.bin:/var/lib/jenkins/jobs/dxx-app/workspace/node_modules/.bin:/var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/NodeJS_0.12.8/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
18921 verbose lifecycle bufferutil@1.2.1~install: CWD: /var/lib/jenkins/jobs/dxx-app/workspace/node_modules/bufferutil
18922 silly lifecycle bufferutil@1.2.1~install: Args: [ '-c', 'node-gyp rebuild' ]
18923 verbose stack Error: write EPIPE
18923 verbose stack     at Object.exports._errnoException (util.js:874:11)
18923 verbose stack     at exports._exceptionWithHostPort (util.js:897:20)
18923 verbose stack     at WriteWrap.afterWrite (net.js:763:14)
18924 verbose cwd /var/lib/jenkins/jobs/dxx-app/workspace
18925 error Linux 3.13.0-57-generic
18926 error argv "/var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/NodeJS_0.12.8/bin/node" "/var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/NodeJS_0.12.8/bin/npm" "install" "browser-sync"
18927 error node v4.2.2
18928 error npm  v3.5.0
18929 error code EPIPE
18930 error errno EPIPE
18931 error syscall write
18932 error write EPIPE
18933 error If you need help, you may report this error at:
18933 error     <https://github.com/npm/npm/issues>
18934 verbose exit [ 1, true ]

It's a weird error which I do NOT. understand.

I am thinking: - maybe jenkins has a weird timeout, when installing larger packages - maybe there is a size limitation for the packages - maybe there is something wrong with the internal builds of the packages

Any ideas?

What I did it try to do my front end build - npm install, etc - without Jenkins on my VPS.

To my surprise the error was the same, which got me googling. It turned out to be a problem with the swap file not being set. Sometimes it's because it is to small, so give it a big size.

Here is a link how to set it up:

https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-12-04?comment=551

After that, I could run npm, and Jenkins was able to do it alsoe.

Regards!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM