pod安装给Jenkins带来错误

时间:2016-05-25 10:37:27

标签: ios jenkins cocoapods

从安装了jenkins的系统运行pod install时运行正常,但是当我们从jenkins运行相同的命令时,它会发出以下错误。我已经通过添加和删除不同的pod来检查是否与特定的pod有关但是它给出了同样的错误。

```
   CocoaPods : 1.0.0
        Ruby : ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin15]
    RubyGems : 2.0.14.1
        Host : Mac OS X 10.11.4 (15E65)
       Xcode : 7.3 (7D175)
         Git : git version 2.6.4 (Apple Git-63)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ 96d7af9b448bfdb55e1319fac100e08341bb8fab
```

### Plugins

```
cocoapods-deintegrate : 1.0.0
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.0.0
cocoapods-trunk       : 1.0.0
cocoapods-try         : 1.0.0
```

### Podfile

```ruby
platform :ios, '7.0'
use_frameworks!

target “MobileShippingApp” do
pod 'Fabric'
pod 'Crashlytics'
end

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = ""
            config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"
            config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"
        end
    end
end
```

### Error

```
NameError - undefined local variable or method `executable' for Pod::Executable:Module
    /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.0.0/lib/cocoapods/executable.rb:111:in `block in which!'
    /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.0.0/lib/cocoapods/executable.rb:110:in `tap'
    /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.0.0/lib/cocoapods/executable.rb:110:in `which!'
    /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.0.0/lib/cocoapods/executable.rb:133:in `capture_command'
    /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.0.0/lib/cocoapods/sources_manager.rb:101:in `git'
    /Library/Ruby/Gems/2.0.0/gems/cocoapods-core-1.0.0/lib/cocoapods-core/source.rb:45:in `block in url'
    /Library/Ruby/Gems/2.0.0/gems/cocoapods-core-1.0.0/lib/cocoapods-core/source.rb:44:in `chdir'
    /Library/Ruby/Gems/2.0.0/gems/cocoapods-core-1.0.0/lib/cocoapods-core/source.rb:44:in `url'
    /Library/Ruby/Gems/2.0.0/gems/cocoapods-core-1.0.0/lib/cocoapods-core/source/manager.rb:347:in `block in source_with_url'
    /Library/Ruby/Gems/2.0.0/gems/cocoapods-core-1.0.0/lib/cocoapods-core/source/manager.rb:346:in `each'
    /Library/Ruby/Gems/2.0.0/gems/cocoapods-core-1.0.0/lib/cocoapods-core/source/manager.rb:346:in `find'
    /Library/Ruby/Gems/2.0.0/gems/cocoapods-core-1.0.0/lib/cocoapods-core/source/manager.rb:346:in `source_with_url'
    /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.0.0/lib/cocoapods/sources_manager.rb:17:in `find_or_create_source_with_url'
    /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.0.0/lib/cocoapods/installer/analyzer.rb:654:in `block in sources'
    /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.0.0/lib/cocoapods/installer/analyzer.rb:653:in `map'
    /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.0.0/lib/cocoapods/installer/analyzer.rb:653:in `sources'
    /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.0.0/lib/cocoapods/installer.rb:144:in `resolve_dependencies'
    /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.0.0/lib/cocoapods/installer.rb:114:in `install!'
    /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.0.0/lib/cocoapods/command/install.rb:37:in `run'
    /Library/Ruby/Gems/2.0.0/gems/claide-1.0.0/lib/claide/command.rb:334:in `run'
    /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.0.0/lib/cocoapods/command.rb:50:in `run'
    /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.0.0/bin/pod:55:in `<top (required)>'
    /usr/local/bin/pod:23:in `load'
    /usr/local/bin/pod:23:in `<main>'
    ```

1 个答案:

答案 0 :(得分:2)

我遇到了同样的问题,但不是通过詹金斯。 我认为使用Jenkins设置的系统操作系统是El Capitan。

我做的是,我卸载了可可豆荚并安装了最新版本的Ruby。 首先,我安装了Homebrew。

Homebrew附带一个非常简单的安装脚本。当它要求您安装XCode CommandLine Tools时,请说“是”。

打开终端并运行以下命令:

ruby -e "$(curl -fsSL    https://raw.githubusercontent.com/Homebrew/install/master/install)" 

之后我使用rbenv安装了Ruby 2.3.1

brew install rbenv ruby-build
rbenv install 2.3.1
rbenv global 2.3.1ruby -v

安装最新版本的Ruby之后,我按照以下步骤安装了CocoaPods

sudo gem install -n /usr/local/bin cocoapods


宝石成功安装后

$ export PATH=$PATH:/Library/Ruby/bin

您可以查看此问题以获取更多详细信息 https://github.com/CocoaPods/CocoaPods/issues/3692