您的Ruby版本是1.9.3,但您的Gemfile指定为2.2.2

时间:2015-11-19 23:36:44

标签: ruby-on-rails ruby

尝试上传代码时出现版本错误。我见过其他帖子,但由于我从Cloud9工作,似乎这些并没有正确地指导我。当使用命令" ruby​​ -v"它显示了2.2.2

下面的Gem文件:

source 'https://rubygems.org'

ruby '2.2.2'
gem 'rails', '4.2.1'
# Bundle edge Rails instead:
# gem 'rails',     :git => 'git://github.com/rails/rails.git'

# for Heroku deployment - as described in Ap. A of ELLS book
group :development, :test do
  gem 'sqlite3'
  gem 'byebug'
  gem 'database_cleaner', '1.4.1'
  gem 'capybara', '2.4.4'
  gem 'launchy'
  gem 'rspec-rails', '3.3.2'
  gem 'ZenTest', '4.11.0'
end

group :test do
  gem 'cucumber-rails', :require => false
  gem 'cucumber-rails-training-wheels'
end
group :production do
  gem 'pg'
end

# Gems used only for assets and not required
# in production environments by default.

  #gem 'therubyracer', '~> 0.12.0'
gem 'sass-rails', '~> 5.0.3'
gem 'coffee-rails', '~> 4.1.0'
gem 'uglifier', '>= 2.7.1'

gem 'jquery-rails'
gem 'haml'

# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

1 个答案:

答案 0 :(得分:0)

https://docs.c9.io/docs/writing-a-ruby-app#rvm-support 目前,默认版本为1.9.3

所以在C9控制台上:

rvm use 2.2.2

如果找不到2.2.2,我认为你需要按照该帖子所提到的每个项目安装它。

curl -L https://get.rvm.io | bash -s stable

或者,您也可以拥有一个名为.ruby-version的项目文件 如何生成:

echo 2.2.2 > .ruby-version

如果将来你在本地使用它,RVM应该尊重这个以及rbenv 更多信息: https://rvm.io/workflow/projects