npm过早关闭jenkins构建

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

我正在为我们的内部NodeJS Express项目设置Jenkins构建。

该项目使用一些本机库(用C语言编写)。经过试验和错误设置Python,MSBuild工具(使用windows-build-tools和没有),我没有设法使构建工作。

詹金斯剧本:

pipeline {
  agent any

  stages {
    stage('Download source') {
        steps {
            checkout([
                $class: 'GitSCM', 
                branches: [[name: '*/branch-name']], 
                userRemoteConfigs: 
                [
                    [
                        credentialsId: 'cred-id', 
                        url: 'gitURL'
                    ]
                ]
            ])
        }
    }

    stage('Npm install') {
      steps {
        bat "npm install"
      }
    }
  }     
}

我尝试过NodeJS插件,同样的问题。授予C:\Program Files (x86)\Jenkins文件夹和每个子目录的权限,重新安装所有内容(包,具有不同版本的节点,甚至我的Windows操作系统),但输出始终为:

step: npm install
npm ERR! premature close

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Windows\system32\config\systemprofile\AppData\Roaming\npm-cache\_logs\2019-04-04T16_69_111Z-debug.log

奇怪的是,当我从npm install文件夹运行%JENKINS_HOME%workspace/ProjectName时,它会构建并安装所有内容而不会出现任何警告或错误并且运行顺畅。

抱歉,我已经对这个主题进行了为期3周的研究,看了很多文章和帖子,但这个问题已经存在了很长一段时间,我们无法管理构建任何Node项目。

node.js jenkins npm deployment node-gyp
1个回答
1
投票

好的,经过2个星期的悲惨尝试才能完成这项工作,唯一有效的解决方案是:

yarn install

代替:

npm install

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