IT TIP

Ruby 버전은 2.0.0이지만 Gemfile은 2.1.0을 지정했습니다.

itqueen 2020. 12. 14. 21:24
반응형

Ruby 버전은 2.0.0이지만 Gemfile은 2.1.0을 지정했습니다.


번들 설치를 시도하면 다음 메시지가 표시됩니다.

Your Ruby version is 2.0.0, but your Gemfile specified 2.1.0

내 Gemfile에는 다음이 있습니다.

ruby '2.1.0'

ruby -v콘솔에서 실행하면 다음과 같은 결과가 나타납니다 .

ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin12.0]

Ruby 2.1.0p0은 무엇을 의미합니까? Gemfile에 어떤 버전이 있어야하며 Ruby 버전 2.0.0이 있다는 오류가 표시되는 이유는 무엇입니까?


운영

gem install bundler

또는

gem update bundler 

문제를 해결할 수 있습니다.

새로 설치된 모든 Ruby 버전의 경우 새 번 들러를 업데이트하거나 설치해야합니다.


프로젝트의 최상위 디렉토리에 .ruby-version포함 ( 기다리십시오 ... ) 이라는 파일을 만듭니다.

2.1.0

이것은 분명히 {rbenv,rvm}현재 버전을 지정하는 교차 방식입니다.


Rails 프로젝트에서 이것을 얻고 최근에 Ruby 버전을 업그레이드했다면 이전 버전의 Ruby로 봄이 계속 실행될 수 있습니다 .

./bin/spring stop

이 문제를 해결할 것입니다.


저에게는 어떤 답변도 도움이되지 않았습니다. 터미널을 닫고 다시 여는 문제를 해결했습니다.


Capistrano를 사용하는 경우 deploy.rb파일에서 set :rbenv_ruby구성을 확인해야 합니다 .


ruby-install으로 업그레이드 한 후 이것을 얻었습니다 . 다음으로이 문제를 해결했습니다.

gem install bundler

뒤에 :

$HOME/.rubies/ruby-2.4.1/bin/bundle

which bundle이미이 경로를 사용하고 있음을 나타내므로 경로를 지정할 필요가 없습니다 . 그러나 bundle경로없이 실행하면 버전 오류가 발생합니다 . 왜 그런지 모르겠어요?


다른 제안은 나에게 효과가 없었습니다. 서버에서 다음을 수행해야했습니다.

rvm --default use [correct version number]


rbenv를 사용하여 루비 환경을 관리하는 경우 rbenv local 2.1.0프로젝트 디렉토리 내에서 실행 하여 gemfile이 요구하는 루비 버전을 설정할 수 있습니다 .


위의 답변 중 어느 것도 저에게 효과가 없었지만

$ gem pristine --all

나를 위해 트릭을 했어

Buona Fortuna


고급 프로젝트의 경우 .versions.conf가 지원되며 Ruby 버전 이상을 지정할 수 있습니다.

.versions.conf 생성 :

rvm --create --versions-conf use 1.9.3@my_app

.versions.conf 예 :

ruby=jruby-1.6.8
ruby-gemset=my_app
env-JRUBY_OPTS=--1.9

서버 구성이 올바른 Ruby 설치를 가리키는 지 확인하십시오.

이미 .ruby-version파일 에서 Ruby 버전을 업데이트 했지만 수정되지 않았습니다. ruby -v또한 올바른 버전을 표시했지만 서버 구성을 업데이트하는 것을 잊었습니다.

예를 들어, rbenv, NGINX 및 Pushion Passenger를 사용하여 NGINX 서버 블록에 포함했습니다.
passenger_ruby /Users/myusername/.rbenv/versions/2.3.1/bin/ruby;

그리고 저는 ...
passenger_ruby /Users/myusername/.rbenv/versions/2.3.3/bin/ruby;

그런 다음 NGINX를 다시 시작하고 작동했습니다.


brew cleanup ruby HomeBrew를 사용하여 Ruby를 설치하면서 저를 위해 일했습니다.

최근에 HomeBrew를 통해 Ruby를 업데이트했지만 HomeBrew는 이전 버전을 제거하지 않았습니다. brew cleanup ruby이전 버전의 Ruby를 삭제합니다.


This could happen when you install new version of ruby and update .ruby-version and Gemfile to the new version without doing install all the gems for new version of ruby first. So do the

$ bundle install

and you might as well need to source .profile or restart your shell.


Thanks for the info about installing / updating bundler but it didn't work for me. I had to do rbenv rehash


Had the same error. Doing the following fixed it. I was using ruby 2.5.5 and rbenv. Upgraded from 2.5.1.

  • rbenv rehash
  • gem uninstall bundler
  • gem install bundler
  • gem install bundler:1.17.3 (my app needed specific bundler -v 1.17.3)
  • gem install rails

I face the error msg

Your Ruby version is 2.5.1, but your Gemfile specified 2.3.0

and solved by the following steps:

  1. open Gemfile which located at your directory.
  2. change ruby '2.3.0' to ruby '2.5.1' and save the Gemfile
  3. go back to items and run bundle update.

the issue is perfectly solved.

참고URL : https://stackoverflow.com/questions/23039528/your-ruby-version-is-2-0-0-but-your-gemfile-specified-2-1-0

반응형