npm安装在Jenkins OpenShift即时应用程序中

时间:2016-02-25 12:50:40

标签: jenkins openshift npm-install

我已在我的OpenShift帐户中部署了即时应用Jenkins。我创建了一份新工作,它从Bitbucket中提取代码。这是一个NodeJS项目,所以我添加了一个要执行的操作:

npm install

但我得到了许可错误:

npm ERR! Error: EACCES, mkdir '/var/lib/openshift/56cef0c72d5271b01a000010/.npm'
npm ERR!  { [Error: EACCES, mkdir '/var/lib/openshift/56cef0c72d5271b01a000010/.npm']
npm ERR!   errno: 3,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/var/lib/openshift/56cef0c72d5271b01a000010/.npm' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Linux 2.6.32-573.18.1.el6.x86_64
npm ERR! command "node" "/usr/bin/npm" "install"
npm ERR! cwd /var/lib/openshift/56cef0c72d5271b01a000010/app-root/data/workspace/oauth2-server
npm ERR! node -v v0.6.20
npm ERR! npm -v 1.1.37
npm ERR! path /var/lib/openshift/56cef0c72d5271b01a000010/.npm
npm ERR! code EACCES
npm ERR! message EACCES, mkdir '/var/lib/openshift/56cef0c72d5271b01a000010/.npm'
npm ERR! errno 3
npm ERR! 3 errno
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /var/lib/openshift/56cef0c72d5271b01a000010/app-root/data/workspace/oauth2-server/npm-debug.log
npm ERR! not ok code undefined
npm ERR! not ok code 3
Build step 'Execute shell' marked build as failure

显然,我无权在OpenShift中使用sudo npm install。我已经读过这个问题,但我无法解决。

有什么办法可以解决吗?

1 个答案:

答案 0 :(得分:0)

以下是您需要做的事情:

  1. 安装NodeJS Jenkins Plugin
  2. 配置插件以从nodejs.org和pick your desired version
  3. 安装NodeJS
  4. 配置您的构建作业,然后选择提供节点&在构建环境下的npm bin /文件夹到PATH