我在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安装了Jenkins(镜像jenkinsjenkins:lts),并在Jenkins中安装了NodeJS插件。
我是这样创建Node工具的。
你知道可能发生了什么吗?
一个问候。
sudo ln -s varlibjenkinstoolsjenkins.plugins.nodejs.tools.NodeJSInstallationnodebinnode usrbinnode