错误 "usrbinenv:'node'.No such file or directory "在Jenkins pipeline中。没有这样的文件或目录 "在Jenkins管道中。

问题描述 投票:1回答:1

我在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工具的。

enter image description here

你知道可能发生了什么吗?

一个问候。

node.js jenkins jenkins-plugins jenkins-pipeline
1个回答
0
投票

sudo ln -s varlibjenkinstoolsjenkins.plugins.nodejs.tools.NodeJSInstallationnodebinnode usrbinnode

© www.soinside.com 2019 - 2024. All rights reserved.