本文介绍了您的 Ruby 版本是 1.9.3,但您的 Gemfile 指定了 2.1.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我跑步时

rails server

我收到错误消息.

加载 gemset 时出现问题

There is some problem loading the gemsets

$rvm list
rvm rubies
ruby-1.9.3-p484 [ i686 ]
ruby-2.0.0-p353 [ i686 ]
=* ruby-2.1.0 [ i686 ]
# => - current
# =* - current && default
#  * - default

$ruby -v
ruby 2.1.0p0 (2013-12-25 revision 44422) [i686-linux]

$rails -v
Your Ruby version is 1.9.3, but your Gemfile specified 2.1.0

$bundle show rails
/home/prasad/.rvm/gems/ruby-2.1.0/gems/rails-4.0.1

$bundle exec rails s
Your Ruby version is 1.9.3, but your Gemfile specified 2.1.0

bundle exec ruby -v
ruby 2.1.0p0 (2013-12-25 revision 44422) [i686-linux]

我做了 bundle install 并尝试启动 rails 服务器,但它给出了同样的错误.

I did bundle install and tried to start the rails server but it gave the same error.

PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"

Gemfile

source 'https://rubygems.org'
ruby '2.1.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.1'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '2.3.1'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# Use jquery as the JavaScript library
gem 'jquery-rails', '3.0.4'
gem 'haml', '4.0.4'
gem 'actionpack-page_caching', '1.0.2' #use caches_pages in rails 4
gem 'twitter'
gem 'mina'
group :production do
  gem 'dalli', '2.6.4'
  gem 'therubyracer'
end
group :test do
  gem 'watir-rails'
end
group :staging do
  gem 'rails_12factor'
end
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end

更新

我尝试重新启动计算机,但没有解决问题.

I tried restarting my computer, but it did not fix the problem.

推荐答案

问题在于您的 PATH 环境变量,它必须匹配 GEM_PATH 而在您的情况下不是.要修复它,请运行:

The problem is your PATH environment variable, it has to match GEM_PATH and in your case it does not. To fix it run:

rvm get stable --auto-dotfiles

这将更新您的 shell 初始化文件并确保正确加载 rvm.然后打开一个新终端(关闭应用程序并再次打开它),然后运行:

This will update your shell initialization files and make sure rvm is properly loaded. Then open a new terminal (close the application and open it again), and run:

rvm use 2.1.0

在这两个步骤中,阅读打印给您的所有消息.它们很重要,包含有关如何解决问题的信息.RVM 检测问题并尝试修复它们,或者在无法或不应自动修复时向您发出警告.

On both steps read all the messages printed to you. They are important and contain information about how to fix your problems. RVM detects problems and tries to fix them or warns you about them if they can not or should not be fixed automatically.

这篇关于您的 Ruby 版本是 1.9.3,但您的 Gemfile 指定了 2.1.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 18:25