加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – Bundler :: RubyVersionMismatch:您的Ruby版

发布时间:2020-12-16 21:43:01 所属栏目:百科 来源:网络整理
导读:我正在使用带有Pow,Ruby,Rails和一堆有用宝石的Mac.每当我尝试打开我的应用程序时,我最近都会遇到此错误. Bundler :: RubyVersionMismatch:您的Ruby版本是1.9.3,但您的Gemfile指定为2.0.0 我理解错误,但我找不到为什么它没有在这里使用正确的版本. 一些有用
我正在使用带有Pow,Ruby,Rails和一堆有用宝石的Mac.每当我尝试打开我的应用程序时,我最近都会遇到此错误.

Bundler :: RubyVersionMismatch:您的Ruby版本是1.9.3,但您的Gemfile指定为2.0.0

我理解错误,但我找不到为什么它没有在这里使用正确的版本.

一些有用的信息:

堆栈跟踪

Bundler::RubyVersionMismatch: Your Ruby version is 1.9.3,but your Gemfile specified 2.0.0
~/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/definition.rb:361:in `validate_ruby!'
~/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler.rb:116:in `setup'
~/.rvm/gems/ruby-2.0.0-p247/gems/bundler-1.3.5/lib/bundler/setup.rb:17:in `<top (required)>'
~/Dropbox/Documents/project/Sites/project-profile/config.ru:3:in `block in <main>'
~/Library/Application Support/Pow/Versions/0.4.1/node_modules/nack/lib/nack/builder.rb:4:in `instance_eval'
~/Library/Application Support/Pow/Versions/0.4.1/node_modules/nack/lib/nack/builder.rb:4:in `initialize'
~/Dropbox/Documents/project/Sites/project-profile/config.ru:1:in `new'
~/Dropbox/Documents/project/Sites/project-profile/config.ru:1:in `<main>'
~/Library/Application Support/Pow/Versions/0.4.1/node_modules/nack/lib/nack/server.rb:50:in `eval'
~/Library/Application Support/Pow/Versions/0.4.1/node_modules/nack/lib/nack/server.rb:50:in `load_config'
~/Library/Application Support/Pow/Versions/0.4.1/node_modules/nack/lib/nack/server.rb:43:in `initialize'
~/Library/Application Support/Pow/Versions/0.4.1/node_modules/nack/lib/nack/server.rb:13:in `new'
~/Library/Application Support/Pow/Versions/0.4.1/node_modules/nack/lib/nack/server.rb:13:in `run'
~/Library/Application Support/Pow/Versions/0.4.1/node_modules/nack/bin/nack_worker:4:in `<main>'

RVM& Ruby版本

$> ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.5.0]
$> rvm use 
Using /Users/Alex/.rvm/gems/ruby-2.0.0-p247

知道我在这里缺少什么吗?
谢谢!

解决方法

我终于在 RVM documentation中找到了解决方案:

Pow has removed automated detection of rvm,here is how it can be
restored by creating .powenv in the root of the project,according to
Pow docs it should not be checked in to source control (unless all
team members agree on that).

必须将这些行添加到项目根目录的.powenv文件中.然后在重新启动服务器后,一切都像魅力一样!

# detect `$rvm_path`
if [ -z "${rvm_path:-}" ] && [ -x "${HOME:-}/.rvm/bin/rvm" ]
then rvm_path="${HOME:-}/.rvm"
fi
if [ -z "${rvm_path:-}" ] && [ -x "/usr/local/rvm/bin/rvm" ]
then rvm_path="/usr/local/rvm"
fi

# load environment of current project ruby
if
  [ -n "${rvm_path:-}" ] &&
  [ -x "${rvm_path:-}/bin/rvm" ] &&
  rvm_project_environment=`"${rvm_path:-}/bin/rvm" . do rvm env --path 2>/dev/null` &&
  [ -n "${rvm_project_environment:-}" ] &&
  [ -s "${rvm_project_environment:-}" ]
then
  echo "RVM loading: ${rvm_project_environment:-}"
  . "${rvm_project_environment:-}"
else
  echo "RVM project not found at: $PWD"
fi

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读