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'
}
}
}
}