我在ubuntu上安装了jenkins,我安装了节点Plugin,并在全局工具配置下使用npm配置了最新版本的node。
我正在测试运行一条管道,在该管道中我将进行git clone并为我的仓库进行npm安装和npm测试。
我的管道代码示例如下:
pipeline {
environment{
registry = "xxxx"
registyCredential = 'harbor'
dockerImage = ''
}
agent any
tools{
nodejs "node"
}
stages {
stage('Git clone'){
steps{
git branch: 'development', url: 'https://github.com/leeadh/node-jenkins-app-example.git'
}
}
stage('Installing Node') {
steps {
sh 'npm install'
}
}
stage ('Conducting Unit test'){
steps{
sh 'npm test'
}
}
但是,我不断收到
976 verbose stack at ChildProcess.<anonymous> (/var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/node/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
976 verbose stack at ChildProcess.emit (events.js:193:13)
976 verbose stack at maybeClose (internal/child_process.js:999:16)
976 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:266:5)
977 verbose pkgid playground@1.0.0
978 verbose cwd /var/lib/jenkins/workspace/Compile_Code_CI
979 verbose Linux 4.15.0-29-generic
980 verbose argv "/var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/node/bin/node" "/var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/node/bin/npm" "install"
981 verbose node v11.14.0
982 verbose npm v6.7.0
983 error file sh
984 error code ELIFECYCLE
985 error errno ENOENT
986 error syscall spawn
987 error playground@1.0.0 install: `npm-git install`
987 error spawn ENOENT
988 error Failed at the playground@1.0.0 install script.
988 error This is probably not a problem with npm. There is likely additional logging output above.
我试图将节点JS直接安装到我的ubuntu服务器上,但仍然给我同样的错误。
有帮助吗?
PS:奇怪的是,我在另一台jenkins服务器(此服务器正在docker上运行)上尝试了相同的步骤,并且运行得很好。