简体   繁体   English

您的 Ruby 版本是 2.3.1,但您的 Gemfile 指定了 2.5.1

[英]Your Ruby version is 2.3.1 but your Gemfile specified 2.5.1

Whenever I run a Rails command, it states that my Ruby version is 2.3.1 but my Gemfile specified 2.5.1.每当我运行 Rails 命令时,它都会指出我的 Ruby 版本是 2.3.1,但我的 Gemfile 指定的是 2.5.1。 However, "ruby -v" returns "ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]", my path has no references to ruby 2.3.1, and running "rvm list" shows a properly green highlighted 2.5.1.但是,“ruby -v”返回“ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]”,我的路径没有对 ruby​​ 2.3.1 的引用,并且运行“rvm list”显示正确的绿色突出显示 2.5.1。 Bundler is installed, and when I try to run bundle install inside a created Rails folder, a get another "Your Ruby version is 2.3.1 but your Gemfile specified 2.5.1" message. Bundler 已安装,当我尝试在创建的 Rails 文件夹中运行 bundle install 时,得到另一个“您的 Ruby 版本是 2.3.1 但您的 Gemfile 指定为 2.5.1”消息。 Please advise.请指教。

$PATH: $路径:

-bash: /home/alowverus/.rvm/gems/ruby-2.5.1/bin:/home/alowverus/.rvm/gems/ruby-2.5.1@global/bin:/usr/share/rvm/rubies/ruby-2.5.1/bin:/usr/share/rvm/bin:/home/alowverus/.rvm/gems/ruby-2.5.1/bin:/home/alowverus/.rvm/gems/ruby-2.5.1@global/bin:/home/alowverus/.rvm/gems/ruby-2.5.1/bin:/home/alowverus/.rvm/gems/ruby-2.5.1@global/bin:/home/alowverus/.rvm/gems/ruby-2.5.1/bin:/home/alowverus/.rvm/gems/ruby-2.5.1@global/bin:/home/alowverus/.rvm/gems/ruby-2.5.1/bin:/home/alowverus/.rvm/gems/ruby-2.5.1@global/bin:/home/alowverus/bin:/home/alowverus/.local/bin:/home/alowverus/.rvm/gems/ruby-2.5.1/bin:/home/alowverus/.rvm/gems/ruby-2.5.1@global/bin:/home/alowverus/bin:/home/alowverus/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin: No such file or directory

Further information in response to answers: "which rails" returns "/home/alowverus/.rvm/gems/ruby-2.5.1/bin/rails", as expected响应答案的更多信息:“which rails”返回“/home/alowverus/.rvm/gems/ruby-2.5.1/bin/rails”,正如预期的那样

Create two files in the root one .ruby-version mention ruby-2.3.1 and .ruby-gemset mention @gemset-name and cd back to the same directory which will create the rvm wrapper for that application then run在根目录中创建两个文件,一个.ruby-version提到ruby-2.3.1.ruby-gemset提到@gemset-name和 cd 回到同一目录,这将为该应用程序创建 rvm 包装器然后运行

rvm current

which outputs like something输出像什么东西

ruby-2.3.1@gemset-name

then run然后运行

gem install bundler
bundle

may be helpful for you可能对你有帮助

I would try (in no particular order):我会尝试(没有特别的顺序):

  • which rails , is it the correct one? which rails ,它是正确的吗?
  • bundle exec rails c (or whatever your command is) bundle exec rails c (或任何你的命令)
  • rvm reload
  • To start clean, rvm implode and try reinstalling rvm and your Ruby version.要开始清理, rvm implode并尝试重新安装rvm和您的 Ruby 版本。

Your Ruby version is 2.3.8, but your Gemfile specified 2.3.1您的 Ruby 版本是 2.3.8,但您的 Gemfile 指定了 2.3.1

check ruby version with ruby -v [version like 2.3.8] make sure ruby version should be same on ruby versions as well as in your GemFile if you have not the same version then your put command on your bash_profile (terminal) rbenv global 2.3.8 & rbenv shell 2.3.8 (the version you can specified accordingly ) then delete your Gemfile.lock then install bundle and install bundler .使用ruby -v [version like 2.3.8] 检查 ruby​​ 版本,确保 ruby​​ 版本和 GemFile 上的 ruby​​ 版本应该相同,如果你没有相同的版本,那么你的rbenv global 2.3.8 & rbenv shell 2.3.8 (终端) rbenv global 2.3.8 & rbenv shell 2.3.8上的 put 命令rbenv global 2.3.8 & rbenv shell 2.3.8 (您可以相应指定的版本)然后删除您的 Gemfile.lock 然后安装 bundle 并安装 bundler 。 these steps working form me.这些步骤对我有用。

rbenv global 2.3.8
rbenv shell 2.3.8
delete your Gemfile.lock
install bundle 
install bundler

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 您的Ruby版本是2.3.1,但是您的Gemfile指定了2.3.1(相同版本) - Your Ruby version is 2.3.1, but your Gemfile specified 2.3.1 (same version) 您的Ruby版本是2.5.1,但您的Gemfile指定了2.4.0 - Your Ruby version is 2.5.1 but your Gemfile specified 2.4.0 您的Ruby版本是2.5.1,但您的Gemfile指定了2.6.3 - Your Ruby version is 2.5.1, but your Gemfile specified 2.6.3 您的 Ruby 版本是 2.3.1,但您的 Gemfile 指定了 2.1.4 - Your Ruby version is 2.3.1, but your Gemfile specified 2.1.4 Bundler :: RubyVersionMismatch:您的Ruby版本是2.3.1,但是您的Gemfile指定了2.1.8 - Bundler::RubyVersionMismatch: Your Ruby version is 2.3.1, but your Gemfile specified 2.1.8 您的Ruby版本是2.3.1,但是您的Gemfile指定了2.4.1 - Your Ruby version is 2.3.1, but your Gemfile specified 2.4.1 如何解决“您的 Ruby 版本是 2.5.3,但您的 Gemfile 指定 2.5.1”部署 AWS eb? - How to fix "Your Ruby version is 2.5.3, but your Gemfile specified 2.5.1" deploying the AWS eb? 修复rbenv和rails 5.2的“您的Ruby版本为2.4.4,但您的Gemfile指定了2.5.1”的错误 - Fixing 'Your Ruby version is 2.4.4, but your Gemfile specified 2.5.1' error with rbenv and rails 5.2 您的Ruby版本是1.9.3,但是您的Gemfile指定了2.2.2 - Your Ruby version is 1.9.3, but your Gemfile specified 2.2.2 您的 Ruby 版本是 2.2.4,但是您的 Gemfile 指定了 2.3.0? - Your Ruby version is 2.2.4, but your Gemfile specified 2.3.0?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM