简体   繁体   English

Jenkins无法安装npm软件包

[英]Jenkins fails to install npm packages

Something weird is happening with my Jenkins install. 我的Jenkins安装发生了一些奇怪的事情。

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

Here, I have a two build steps, consisting of two shell scripts: 在这里,我有两个构建步骤,包括两个shell脚本:

First: npm install jspm 首先: npm install jspm

Second: npm install browser-sync 第二: npm安装浏览器同步

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: ------ 2 ------如果我只运行一个构建步骤,运行以下shell脚本,它将一起破坏jenkins服务:

Shell script: npm install browser-sync Shell脚本: 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 ------ 3 ------如果运行以下shell脚本,则可以运行: 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: 另外,jenkins不会在日志中报告任何错误,但是我在工作区找到了npm调试日志:

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 我在想:-在安装较大的软件包时,jenkins的超时可能很奇怪-软件包的大小可能受到限制-软件包的内部版本可能有问题

Any ideas? 有任何想法吗?

What I did it try to do my front end build - npm install, etc - without Jenkins on my VPS. 我所做的就是尝试在VPS上没有Jenkins的情况下进行前端构建-npm安装等。

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. 在那之后,我可以运行npm,詹金斯也可以做到。

Regards! 问候!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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