我们有一个运行Jenkins的EC2 Ubuntu盒子,用于构建和测试节点应用程序。 Jenkins所做的部分工作是下载依赖项。其中一个依赖项(哈希环)在安装时会出现ELIFECYCLE错误。但是,只有在使用jenkins用户进行安装时才会出现此错误。我可以用ubuntu用户安装sudo,但我似乎无法用jenkins用户安装这个包。 jenkins用户可以很好地安装所有其他软件包。这是一个为ubuntu安装hashling的例子,不是为jenkins安装,然后是jenkins成功安装express。
有什么想法吗?我觉得我已经阅读并尝试了一切。我已完全卸载并重新安装了node,npm和node-gyp,并尝试根据此问题使用不同的版本组合(https://github.com/TooTallNate/node-gyp/issues/598),但它似乎没有效果。
ubuntu@ip-10-0-0-10:~$ sudo npm install hashring
\
> hashring@3.1.0 install /home/ubuntu/node_modules/hashring
> node-gyp rebuild
make: Entering directory `/home/ubuntu/node_modules/hashring/build'
CXX(target) Release/obj.target/hashvalue/src/hashvalue.o
SOLINK_MODULE(target) Release/obj.target/hashvalue.node
SOLINK_MODULE(target) Release/obj.target/hashvalue.node: Finished
COPY Release/hashvalue.node
make: Leaving directory `/home/ubuntu/node_modules/hashring/build'
hashring@3.1.0 node_modules/hashring
├── bindings@1.2.1
├── connection-parse@0.0.7
├── simple-lru-cache@0.0.1
└── nan@1.5.3
ubuntu@ip-10-0-0-10:~$ sudo su root
root@ip-10-0-0-10:/home/ubuntu# su jenkins
jenkins@ip-10-0-0-10:/home/ubuntu$ cd ~/workspace/test
jenkins@ip-10-0-0-10:~/workspace/test$ npm install hashring
> hashring@3.1.0 install /var/lib/jenkins/workspace/test/node_modules/hashring
> node-gyp rebuild
gyp ERR! UNCAUGHT EXCEPTION
gyp ERR! stack Error: spawn ENOTDIR
gyp ERR! stack at exports._errnoException (util.js:746:11)
gyp ERR! stack at ChildProcess.spawn (child_process.js:1155:11)
gyp ERR! stack at exports.spawn (child_process.js:988:9)
gyp ERR! stack at exports.execFile (child_process.js:682:15)
gyp ERR! stack at checkPythonVersion (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:79:5)
gyp ERR! stack at /usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:46:9
gyp ERR! stack at which (/usr/local/lib/node_modules/npm/node_modules/which/which.js:30:31)
gyp ERR! stack at checkPython (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:36:5)
gyp ERR! stack at configure (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:31:3)
gyp ERR! stack at Object.self.commands.(anonymous function) [as configure] (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/node-gyp.js:66:37)
gyp ERR! System Linux 3.13.0-36-generic
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /var/lib/jenkins/workspace/test/node_modules/hashring
gyp ERR! node -v v0.12.1
gyp ERR! node-gyp -v v1.0.3
gyp ERR! This is a bug in `node-gyp`.
gyp ERR! Try to update node-gyp and file an Issue if it does not help:
gyp ERR! <https://github.com/TooTallNate/node-gyp/issues>
npm ERR! Linux 3.13.0-36-generic
npm ERR! argv "node" "/usr/local/bin/npm" "install" "hashring"
npm ERR! node v0.12.1
npm ERR! npm v2.7.3
npm ERR! code ELIFECYCLE
npm ERR! hashring@3.1.0 install: `node-gyp rebuild`
npm ERR! Exit status 7
npm ERR!
npm ERR! Failed at the hashring@3.1.0 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the hashring package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls hashring
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /var/lib/jenkins/workspace/test/npm-debug.log
jenkins@ip-10-0-0-10:~/workspace/test$ npm install express
express@4.12.3 node_modules/express
├── merge-descriptors@1.0.0
├── utils-merge@1.0.0
├── cookie-signature@1.0.6
├── methods@1.1.1
├── fresh@0.2.4
├── cookie@0.1.2
├── escape-html@1.0.1
├── range-parser@1.0.2
├── finalhandler@0.3.4
├── content-type@1.0.1
├── vary@1.0.0
├── parseurl@1.3.0
├── serve-static@1.9.2
├── content-disposition@0.5.0
├── path-to-regexp@0.1.3
├── depd@1.0.0
├── on-finished@2.2.0 (ee-first@1.1.0)
├── qs@2.4.1
├── debug@2.1.3 (ms@0.7.0)
├── proxy-addr@1.0.7 (forwarded@0.1.0, ipaddr.js@0.1.9)
├── etag@1.5.1 (crc@3.2.1)
├── send@0.12.2 (destroy@1.0.3, ms@0.7.0, mime@1.3.4)
├── accepts@1.2.5 (negotiator@0.5.1, mime-types@2.0.10)
└── type-is@1.6.1 (media-typer@0.3.0, mime-types@2.0.10)
jenkins@ip-10-0-0-10:~/workspace/test$
答案 0 :(得分:0)
原来我们必须使用python路径为npm添加配置。
来自jenkins用户:
npm config set python / usr / bin / python