Jenkins无法安装npm包

时间:2015-12-04 16:51:18

标签: node.js jenkins npm

我的Jenkins安装发生了一些奇怪的事情。

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

在这里,我有两个构建步骤,包括两个shell脚本:

首先: npm install jspm

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

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 ------ 如果我运行以下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

什么可能导致这些奇怪的问题?

另外,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 ]

这是一个奇怪的错误,我不这样做。理解。

我在想: - 当安装更大的包时,jenkins可能有一个奇怪的超时 - 可能包装有尺寸限制 - 也许包的内部版本有问题

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

我做了什么尝试做我的前端构建 - npm安装等 - 在我的VPS上没有Jenkins。

令我惊讶的是,错误是一样的,这让我用谷歌搜索。 事实证明,未设置交换文件存在问题。 有时它是因为它很小,所以给它一个大的尺寸。

以下是如何设置的链接:

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

在那之后,我可以运行npm,并且Jenkins也可以这样做。

问候!