我有一个使用https://github.com/shierro/jenkins-docker-examples/tree/master/05-aws-ecs配置的Jenkins服务器。
我正在使用一个简单的Jenkinsfile和jenkins NodeJS插件运行一个Blue Ocean流水线。
pipeline {
agent any
tools {
nodejs 'node10'
}
stages {
stage ('Checkout Code') {
steps {
checkout scm
}
}
stage ('Install dependencies') {
steps {
sh "echo $PATH"
sh "npm install"
}
}
}
}
我确保添加了全局工具node10,并在上面使用了它:
当管道到达脚本sh "npm install"
时,我遇到了以下错误:
这是echo $PATH
命令的输出结果:
所以我认为这不是路径问题。
而且,它也无法添加全局包:
以下信息可能有助于解决问题:
- Docker Jenkins 服务器:
FROM jenkins/jenkins:2.131-alpine
- Blue Ocean 版本:1.7.0
- NodeJS 插件:1.2.6
- 已经尝试多次重新启动服务器
有什么想法,为什么 Jenkins 服务器不知道 node 的位置?
非常感谢您的帮助!
/var/jenkins_home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/node10/bin
。我将尝试使用jenkins / jenkins:lts镜像并回来。 - Theo