简体   繁体   English

Jenkins不能单独运行npm或pm2

[英]Jenkins cannot run npm or pm2 by itself

So I have a Jenkins CI setup on an EC2 server. 因此,我在EC2服务器上安装了Jenkins CI。 I have nodejs and npm installed. 我安装了nodejs和npm。 Weirdly, Jenkins can access them via the command line if I do something like: 奇怪的是,如果执行以下操作,Jenkins可以通过命令行访问它们:

sudo -u jenkins node -v

However, Jenkins cannot access them inside an actual build runtime, and I get the following errors: 但是,Jenkins无法在实际的构建运行时内部访问它们,并且出现以下错误:

npm: command not found
pm2: command not found

npm is definitely installed, and ec2-user/root users can access it. npm 肯定已安装,并且ec2-user / root用户可以访问它。 What PATH do I have to change so that Jenkins can access it too? 我必须更改什么路径才能让Jenkins也可以访问它?

I think that if you use the nodejs plugin it will be easier to manage your node and npm in this box. 我认为,如果您使用nodejs插件,则在此框中管理节点和npm会更容易。 Also, this plugin allows installing some global modules that possibly you will need to build your project: 此外,此插件还允许安装一些可能需要构建项目的全局模块:

https://wiki.jenkins-ci.org/display/JENKINS/NodeJS+Plugin https://wiki.jenkins-ci.org/display/JENKINS/NodeJS+Plugin

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

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