Your Ruby version is 2.5.3, but your Gemfile specified 2.5.1
TL;DR
어느 날 아침, ROR의 프로젝트를 개발 환경에서 시작하려고 했더니, 이런 에러가 토해졌다. 그 디버그 기록입니다.
Debug
언제나처럼 개발 환경의 ROR 프로젝트를 gem foreman에서 시작하려고했습니다.
$ ~/project_dir bundle exec foreman start -f Procfile.dev
그런데 이런 오류가,,
#=> Your Ruby version is 2.5.3, but your Gemfile specified 2.5.1
과연, 참조처의 ruby version과 Gemfile로 설정하고 있는 ruby version이 다른 것 같다. 솔직하게 Gemfile의 ruby version을 참조처와 함께 2.5.3으로 설정하자.
설정했다. 한 번 더 시작.
$ ~/project_dir bundle exec foreman start -f Procfile.dev
그러나 이번에는
#=> 11:18:47 frontend.1 | exited with code 1
webpacl-dev-server가 비정상적으로 종료되었습니다. 왜? webpack-dev-server만 실행해 본다.
$ ~/project_dir ./bin/webpack-dev-server
#=> Your Ruby version is 2.5.1, but your Gemfile specified 2.5.3
이번에는 Gemfile로 설정한 루비 2.5.3이 안되는지 웃음
bundler와 webpack-dev-server로 ruby의 참조처가 다르겠지.
그건 그렇고,
$ rbenv versions
system
2.4.1
2.5.0
* 2.5.1
$ ruby -v
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
All the 2.5.1 웃음
도대체 언제 어디에 넣은 2.5.3일까? 그러고 보면 어제 하이볼을 마시면서 django를 괴롭혔을 때에 뭔가 2.5.3이라고 하는 숫자를 본 마음도,,, 아무튼 아무래도 좋을까.
Debug 재개. bundler
는 어디야?
$ which bundler
#=> /usr/local/bin/bundler
내용을 보자.
$ cat /usr/local/bin/bundle
#!/usr/local/opt/ruby/bin/ruby
#
# This file was generated by RubyGems.
#
# The application 'bundler' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'rubygems'
version = ">= 0.a"
if ARGV.first
str = ARGV.first
str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding
if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then
version = $1
ARGV.shift
end
end
if Gem.respond_to?(:activate_bin_path)
load Gem.activate_bin_path('bundler', 'bundle', version)
else
gem "bundler", version
load Gem.bin_path("bundler", "bundle", version)
end
과연 shebang에 따르면, 참조처는 #!/usr/local/opt/ruby/bin/ruby
?
rbenv에서 ruby의 version은 관리하고 있고, 참조처를 직접 바꾸어 버리는가? 잘 작동합니다.
$ sudo vim /usr/local/bin/bundler
환경에서 path를 설정합니다.
#!/usr/local/.rbenv/shims/ruby #変更!
#
# This file was generated by RubyGems.
#
# The application 'bundler' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'rubygems'
version = ">= 0.a"
if ARGV.first
str = ARGV.first
str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding
if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then
version = $1
ARGV.shift
end
end
if Gem.respond_to?(:activate_bin_path)
load Gem.activate_bin_path('bundler', 'bundle', version)
else
gem "bundler", version
load Gem.bin_path("bundler", "bundle", version)
end
그럼 다시,
$ ~/project_dir bundle exec foreman start -f Procfile.dev
11:34:13 web.1 | started with pid 19518
11:34:13 frontend.1 | started with pid 19519
11:34:17 frontend.1 | Project is running at http://localhost:3035/
11:34:17 frontend.1 | webpack output is served from /packs/
11:34:17 frontend.1 | Content not from webpack is served from ***
11:34:20 frontend.1 | No parser and no filepath given, using 'babylon' the parser now but this will throw an error in the future. Please specify a parser or a filepath so one can be inferred.
11:34:20 frontend.1 | No parser and no filepath given, using 'babylon' the parser now but this will throw an error in the future. Please specify a parser or a filepath so one can be inferred.
11:34:25 web.1 | => Booting Puma
11:34:25 web.1 | => Rails 5.2.1 application starting in development
11:34:25 web.1 | => Run `rails server -h` for more startup options
11:34:27 web.1 | Puma starting in single mode...
11:34:27 web.1 | * Version 3.12.0 (ruby 2.5.1-p57), codename: Llamas in Pajamas
11:34:27 web.1 | * Min threads: 5, max threads: 5
11:34:27 web.1 | * Environment: development
11:34:27 web.1 | * Listening on tcp://localhost:5000
11:34:27 web.1 | Use Ctrl-C to stop
오, 움직였다!
요약
루비의 참조를 확인하고 각 프로세스를 담당하는 사람들에게 적절한 참조를 할당하도록 디버깅하자는 느낌이었습니다.
Reference
이 문제에 관하여(Your Ruby version is 2.5.3, but your Gemfile specified 2.5.1), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/kHigasa/items/2e9764e7e80d1bdd8186
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
$ ~/project_dir bundle exec foreman start -f Procfile.dev
#=> Your Ruby version is 2.5.3, but your Gemfile specified 2.5.1
$ ~/project_dir bundle exec foreman start -f Procfile.dev
#=> 11:18:47 frontend.1 | exited with code 1
$ ~/project_dir ./bin/webpack-dev-server
#=> Your Ruby version is 2.5.1, but your Gemfile specified 2.5.3
$ rbenv versions
system
2.4.1
2.5.0
* 2.5.1
$ ruby -v
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
$ which bundler
#=> /usr/local/bin/bundler
$ cat /usr/local/bin/bundle
#!/usr/local/opt/ruby/bin/ruby
#
# This file was generated by RubyGems.
#
# The application 'bundler' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'rubygems'
version = ">= 0.a"
if ARGV.first
str = ARGV.first
str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding
if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then
version = $1
ARGV.shift
end
end
if Gem.respond_to?(:activate_bin_path)
load Gem.activate_bin_path('bundler', 'bundle', version)
else
gem "bundler", version
load Gem.bin_path("bundler", "bundle", version)
end
$ sudo vim /usr/local/bin/bundler
#!/usr/local/.rbenv/shims/ruby #変更!
#
# This file was generated by RubyGems.
#
# The application 'bundler' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'rubygems'
version = ">= 0.a"
if ARGV.first
str = ARGV.first
str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding
if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then
version = $1
ARGV.shift
end
end
if Gem.respond_to?(:activate_bin_path)
load Gem.activate_bin_path('bundler', 'bundle', version)
else
gem "bundler", version
load Gem.bin_path("bundler", "bundle", version)
end
$ ~/project_dir bundle exec foreman start -f Procfile.dev
11:34:13 web.1 | started with pid 19518
11:34:13 frontend.1 | started with pid 19519
11:34:17 frontend.1 | Project is running at http://localhost:3035/
11:34:17 frontend.1 | webpack output is served from /packs/
11:34:17 frontend.1 | Content not from webpack is served from ***
11:34:20 frontend.1 | No parser and no filepath given, using 'babylon' the parser now but this will throw an error in the future. Please specify a parser or a filepath so one can be inferred.
11:34:20 frontend.1 | No parser and no filepath given, using 'babylon' the parser now but this will throw an error in the future. Please specify a parser or a filepath so one can be inferred.
11:34:25 web.1 | => Booting Puma
11:34:25 web.1 | => Rails 5.2.1 application starting in development
11:34:25 web.1 | => Run `rails server -h` for more startup options
11:34:27 web.1 | Puma starting in single mode...
11:34:27 web.1 | * Version 3.12.0 (ruby 2.5.1-p57), codename: Llamas in Pajamas
11:34:27 web.1 | * Min threads: 5, max threads: 5
11:34:27 web.1 | * Environment: development
11:34:27 web.1 | * Listening on tcp://localhost:5000
11:34:27 web.1 | Use Ctrl-C to stop
Reference
이 문제에 관하여(Your Ruby version is 2.5.3, but your Gemfile specified 2.5.1), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/kHigasa/items/2e9764e7e80d1bdd8186텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)