最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Jenkins in Docker Cannot Find NPM: npm: not found (Exit Code 127) - Stack Overflow

programmeradmin0浏览0评论

Description: I am running Jenkins inside a Docker container on Windows 11. I have the Ubuntu app installed from the Microsoft Store, which already has npm version 8.5.1 installed.

However, when I run my Jenkins pipeline, I get the following error during the npm install step:

+ npm install  
/var/jenkins_home/workspace/test-jenkins-nestjs@tmp/durable-8ba17fc4/script.sh.copy: 1: npm: not found  
script returned exit code 127 
pipeline {
    agent any  
    stages {
        stage("checkout") {
            steps {
                checkout scm            
           }
       }        
        stage("Tests") {
            steps {
                sh "sudo apt install npm"  // Installing npm
                sh "npm test"
            }
        }

        stage("Build") {
            steps {
                sh 'npm run build'
            }
        }
    }
}
发布评论

评论列表(0)

  1. 暂无评论