带有多个代理的Jenkins Pipeline npm安装失败

问题描述

我正在尝试创建一个使用docker镜像中的代理的jenkins管道。 我的最终目标是: 1检出git repo, 2-使用节点命令构建它, 3-结帐另一个回购 4-在第二个提交我的第一个回购。 5时空通知

我正在尝试第一步和第二步,并且被npm install命令困住了。

这就是我想要做的:

b

当角度平台到来时,我会收到一条很长的错误消息,并带有40多个警告,简而言之:

无法下载“ https://github.com/sass/node-sass/releases/download/v4.10.0/linux_musl-x64-83_binding.node”:

pipeline {
  agent none
  stages {
    stage('Clean') {
      agent any
      steps {
        deleteDir()
      }
    }

    stage('Checkout') {
      agent any
      steps {
        git(credentialsId: 'test_credential',url: 'giturl',branch: 'master')
      }
    }

    stage('Angular') {
      agent {
        docker {
          image 'node:current-alpine3.11'
        }

      }
      steps {
        sh 'npm install'
      }
    }

  }
}

以下是此错误结束的屏幕:

http://prntscr.com/uj4x8x

我不明白自己的管道在做什么错。 我猜它可能来自执行命令npm install的地方,或者是切换代理不起作用?

我也尝试了这个管道脚本

HTTP error 404 Not Found

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm安装工作在这里,但是我收到此警告,当我使用其他npm命令(例如npm run postinstall或npm run dev0 && npm run build)时会产生错误

pipeline {
    parameters {
        string(name: 'Front_Tag',defaultValue: '2.67.1.4',description: 'this is a description')
    }
    
    stages {
        
        stage('Clean') {
            steps {
                deleteDir()
            }
        }
        
        stage('Checkout Angular') {
            steps{
                checkout([$class: 'GitSCM',branches: [[name: "refs/tags/${Front_Tag}"]],extensions: [[$class: 'RelativeTargetDirectory',relativeTargetDir: 'angular']],submoduleCfg: [],userRemoteConfigs: [[credentialsId: 'test_credential',url: 'myurl']]
                ])
            }
        }
        stage('Angular') {
            agent{
                docker {image 'node:current-alpine3.11'}
            }
            stages {
                stage('Set up'){
                    steps {
                        dir ('angular') {
                              sh "npm install"
                        }
                    }
                }
            }
        }
    }
}

我的gitlab项目中有一个package.json,但在这里它创建了第二个文件夹,末尾有@ 2,其中只有package-lock.json,其他都没有。为什么要创建另一个文件夹?

有人可以帮我解决这个问题吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)