【问题标题】:Gem version issue when trying to install cocoapods in rubymotion尝试在 ruby​​motion 中安装 cocoapods 时出现 Gem 版本问题
【发布时间】:2013-10-10 15:23:47
【问题描述】:

我正在尝试根据 tutorial 将 cocoapods 集成到 ruby​​motion 中,但是,当我运行 rake 时出现错误:

You have already activated i18n 0.6.5, but your Gemfile requires i18n 0.6.1. Using bundle exec may solve this.

我该怎么办,我尝试在 Gemfile 中指定 gem 版本,但没有帮助。这是我Rakefile中的代码。

$:.unshift("/Library/RubyMotion/lib")
require 'motion/project/template/ios'
require 'rubygems'
require 'motion-cocoapods'

# if you use bundler
require 'bundler'
Bundler.require

# if you are not using bundler
# require 'rubygems'
# require 'ib'

Motion::Project::App.setup do |app|
  # Use `rake config' to see complete project settings.
  app.name = 'IBSample'

  app.pods do
    platform :ios, '6.0'
    pod 'SWRevealViewController', '~> 1.0.5'
  end
end

更新:这里是 gemfile

# A sample Gemfile
source "https://rubygems.org"

gem "ib"
gem "rake"
# gem "i18n", "0.6.1"

当我运行 bundle exec rake 时,我得到了

cannot load such file -- motion-cocoapods

请注意,我已经安装了 motion-cocoapods 并检查了它是否在我的 gem 列表中。

【问题讨论】:

  • 您也可以发布 Gemfile 吗?您是否尝试过在命令前加上 bundle exec?例如bundle exec rake
  • @FluffyJack bundle exec 给出:无法加载这样的文件——motion-cocoapods
  • 尝试更新您的 ruby​​gems gem update --system。还有你用的是什么版本的红宝石?
  • @FluffyJack gem update --system 没有修复它,我在这个项目中使用ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-darwin13.0.0],但我也使用 2.0 和我的 rails
  • 复制这一切,看看会发生什么。

标签: rubymotion cocoapods


【解决方案1】:

解决办法很简单,显然是定位。

删除 require 'motion-cocoapods' 并将 gem motion-cocoapods 放入您的 Gemfile 中,或者从您的 Rakefile 中删除捆绑程序代码并手动要求所有内容。

$:.unshift("/Library/RubyMotion/lib")
require 'motion/project/template/ios'
require 'rubygems'

require 'ib'
require 'motion-cocoapods'

Motion::Project::App.setup do |app|
  # Use `rake config' to see complete project settings.
  app.name = 'IBSample'

  app.pods do
    platform :ios, '6.0'
    pod 'SWRevealViewController', '~> 1.0.5'
  end
end

虽然由于 pod 定义中的 platform 导致我收到错误,但除非你真的需要它,否则你可能会删除它,那么这就是你的下一个问题 :)

【讨论】:

    最近更新 更多