使用yarn install时出错/除非用户TTY,否则无法回答问题

时间:2019-10-31 15:15:25

标签: jenkins jenkins-pipeline yarn yarnpkg

我在 Debian Stretch(4.9.168)上使用yarn,安装了Jenkins,并尝试从我的Jenkinsfile中运行yarn install --no-progress --flat --network-timeout=1000000

yarn已通过Jenkins(npm install -g yarn@latest)上的Node.JS的全局配置安装,但是Jenkinsfile尝试运行上述安装命令时,出现以下错误:< / p>

+ yarn install --no-progress --flat --network-timeout=1000000
yarn install v1.19.1
[1/4] Resolving packages...
error An unexpected error occurred: "Can't answer a question unless a user TTY".
info If you think this is a bug, please open a bug report with the information provided in "/data/jenkins/workspace/REPONAME_PR-1-head/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
script returned exit code 1

因此,显然纱线已正确安装。稍作搜索就为Windows带来了一些信息,但没有为Linux修复它。有人知道如何解决此问题吗?

Jenkinsfile看起来像这样:

#!/usr/bin/env groovy
pipeline {
  agent {
    label 'linux'
  }

  tools {
    nodejs "NodeJS_v11.9.0"
  }

  stages {
    stage("Cleanup") {
      steps {
        sh yarn cache clean
        dir('node_modules') {
          deleteDir()
        }
      }
    }
    stage("Install dependencies") {
      failFast true
      steps {
        sh yarn install --no-progress --flat --network-timeout=1000000
      }
    }

  }

}

非常感谢,感谢您的帮助!

0 个答案:

没有答案