我在Jenkins中为Nodejs应用程序创建了一个管道,配置如下:
pipeline {
agent any
stages {
stage('Build') {
steps {
nodejs(nodeJSInstallationName: 'Node8') {
sh 'npm install'
}
}
}
stage('Test') {
steps {
nodejs(nodeJSInstallationName: 'Node8') {
sh 'npm run test'
}
}
}
stage('Deploy') {
steps {
nodejs(nodeJSInstallationName: 'Node8') {
sh 'npm run start'
}
}
}
}}
但是'npm‘的执行失败了,这给了我以下错误:
+ npm install
/usr/bin/env:'node': No such file or directory我使用Docker (image jenkins/ Jenkins :lts)在我的服务器上安装了Jenkins,并在Jenkins中安装了NodeJS插件。
我以这种方式创建了Node工具:

你知道可能会发生什么吗?
一句问候。
发布于 2021-03-22 18:31:15
尝尝这个
sudo ln -sf“$(哪个节点)”/usr/bin/node
发布于 2020-04-23 15:52:21
sudo ln -s /var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/node/bin/node /usr/-s/node
https://stackoverflow.com/questions/51361208
复制相似问题