【问题标题】:Azure devops pipeline on mac agent : Could not locate Gemfile when bundle installmac 代理上的 Azure devops 管道:捆绑安装时找不到 Gemfile
【发布时间】:2020-12-25 01:38:48
【问题描述】:

我尝试通过 Mac 代理上的 Azure DevOps 管道安装,但一直收到此错误: - 任务:CmdLine@2 输入: 脚本:'mkdir ios'

  - script: |
     cd ios 
     gem install bundler

     bundle update --bundler

     bundle install
     
    workingDirectory: ios
    displayName: 'Ruby bundle setup'

错误:

2020-09-06T11:54:07.5917840Z ##[section]Starting: Ruby bundle setup
2020-09-06T11:54:07.5928350Z ==============================================================================
2020-09-06T11:54:07.5928740Z Task         : Command line
2020-09-06T11:54:07.5929150Z Description  : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
2020-09-06T11:54:07.5929490Z Version      : 2.164.2
2020-09-06T11:54:07.5929750Z Author       : Microsoft Corporation
2020-09-06T11:54:07.5930170Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
2020-09-06T11:54:07.5930590Z ==============================================================================
2020-09-06T11:54:07.7401990Z Generating script.
2020-09-06T11:54:07.7424640Z ========================== Starting Command Output ===========================
2020-09-06T11:54:07.7456160Z [command]/bin/bash --noprofile --norc /Users/runner/work/_temp/d9733c1e-f521-48ca-aa7c-9d3b24c88953.sh
2020-09-06T11:54:07.7526110Z /Users/runner/work/_temp/d9733c1e-f521-48ca-aa7c-9d3b24c88953.sh: line 1: cd: ios: No such file or directory
2020-09-06T11:54:12.3083310Z Successfully installed bundler-2.1.4
2020-09-06T11:54:12.3084130Z Parsing documentation for bundler-2.1.4
2020-09-06T11:54:12.3084780Z Installing ri documentation for bundler-2.1.4
2020-09-06T11:54:12.3085110Z Done installing documentation for bundler after 3 seconds
2020-09-06T11:54:12.3085430Z 1 gem installed
2020-09-06T11:54:12.6954440Z Could not locate Gemfile
2020-09-06T11:54:13.1617230Z Could not locate Gemfile
2020-09-06T11:54:13.1694000Z 
2020-09-06T11:54:13.1763400Z ##[error]Bash exited with code '10'.
2020-09-06T11:54:13.1779990Z ##[section]Finishing: Ruby bundle setup

即使我遵循本教程: https://docs.microsoft.com/en-us/azure/devops/pipelines/ecosystems/ruby?view=azure-devops

我仍然得到:

2020-09-06T12:27:31.6476200Z ##[section]Starting: bundle install
2020-09-06T12:27:31.6490380Z ==============================================================================
2020-09-06T12:27:31.6490780Z Task         : Command line
2020-09-06T12:27:31.6491150Z Description  : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
2020-09-06T12:27:31.6491570Z Version      : 2.164.2
2020-09-06T12:27:31.6491830Z Author       : Microsoft Corporation
2020-09-06T12:27:31.6492250Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
2020-09-06T12:27:31.6492690Z ==============================================================================
2020-09-06T12:27:31.8007410Z Generating script.
2020-09-06T12:27:31.8038100Z ========================== Starting Command Output ===========================
2020-09-06T12:27:31.8070710Z [command]/bin/bash --noprofile --norc /Users/runner/work/_temp/79d6c766-b735-4025-8576-a11120d84585.sh
2020-09-06T12:27:36.4057030Z Successfully installed bundler-2.1.4
2020-09-06T12:27:36.4068290Z Parsing documentation for bundler-2.1.4
2020-09-06T12:27:36.4073040Z Installing ri documentation for bundler-2.1.4
2020-09-06T12:27:36.4116410Z Done installing documentation for bundler after 3 seconds
2020-09-06T12:27:36.4130600Z 1 gem installed
2020-09-06T12:27:36.7989650Z Could not locate Gemfile
2020-09-06T12:27:36.8083080Z 
2020-09-06T12:27:36.8160820Z ##[error]Bash exited with code '10'.
2020-09-06T12:27:36.8177100Z ##[section]Finishing: bundle install

【问题讨论】:

    标签: ruby macos azure-devops azure-pipelines


    【解决方案1】:

    Mac 代理上的 Azure devops 管道:捆绑安装时找不到 Gemfile

    根据报错信息:

    Could not locate Gemfile
    

    我们的工作区目录中似乎没有Gemfile

    要解决这个问题,我们需要先运行bundle init,然后运行bundle install

    作为测试,我在您的 CmdLine 任务中添加了bundle init,如下所示,它工作正常:

    - script: |
       mkdir ios
       
       cd ios
       
       gem install bundler
       
       bundle init
       
       bundle update --bundler
       
       bundle install
       
      displayName: 'Ruby bundle setup'
    

    结果:

    【讨论】:

      猜你喜欢
      • 2012-04-18
      • 2011-08-19
      • 1970-01-01
      • 2021-12-29
      • 2019-08-31
      • 2021-12-17
      • 1970-01-01
      • 1970-01-01
      • 2021-12-28
      相关资源
      最近更新 更多