1.3節から、チュートリアルに合流する
> bundle exec rails _5.1.6_ new hello_app create create README.md create Rakefile create .ruby-version create config.ru create .gitignore create Gemfile run git init from "." Initialized empty Git repository in /Users/tambara/study/rails_study/hello_app/.git/ create package.json create app create app/assets/config/manifest.js create app/assets/javascripts/application.js create app/assets/javascripts/cable.js create app/assets/stylesheets/application.css create app/channels/application_cable/channel.rb create app/channels/application_cable/connection.rb create app/controllers/application_controller.rb create app/helpers/application_helper.rb create app/jobs/application_job.rb create app/mailers/application_mailer.rb create app/models/application_record.rb create app/views/layouts/application.html.erb create app/views/layouts/mailer.html.erb create app/views/layouts/mailer.text.erb create app/assets/images/.keep create app/assets/javascripts/channels create app/assets/javascripts/channels/.keep create app/controllers/concerns/.keep create app/models/concerns/.keep create bin create bin/bundle create bin/rails create bin/rake create bin/setup create bin/update create bin/yarn create config create config/routes.rb create config/application.rb create config/environment.rb create config/cable.yml create config/puma.rb create config/spring.rb create config/storage.yml create config/environments create config/environments/development.rb create config/environments/production.rb create config/environments/test.rb create config/initializers create config/initializers/application_controller_renderer.rb create config/initializers/assets.rb create config/initializers/backtrace_silencers.rb create config/initializers/content_security_policy.rb create config/initializers/cookies_serializer.rb create config/initializers/cors.rb create config/initializers/filter_parameter_logging.rb create config/initializers/inflections.rb create config/initializers/mime_types.rb create config/initializers/new_framework_defaults_5_2.rb create config/initializers/wrap_parameters.rb create config/locales create config/locales/en.yml create config/master.key append .gitignore create config/boot.rb create config/database.yml create db create db/seeds.rb create lib create lib/tasks create lib/tasks/.keep create lib/assets create lib/assets/.keep create log create log/.keep create public create public/404.html create public/422.html create public/500.html create public/apple-touch-icon-precomposed.png create public/apple-touch-icon.png create public/favicon.ico create public/robots.txt create tmp create tmp/.keep create tmp/cache create tmp/cache/assets create vendor create vendor/.keep create test/fixtures create test/fixtures/.keep create test/fixtures/files create test/fixtures/files/.keep create test/controllers create test/controllers/.keep create test/mailers create test/mailers/.keep create test/models create test/models/.keep create test/helpers create test/helpers/.keep create test/integration create test/integration/.keep create test/test_helper.rb create test/system create test/system/.keep create test/application_system_test_case.rb create storage create storage/.keep create tmp/storage create tmp/storage/.keep remove config/initializers/cors.rb remove config/initializers/new_framework_defaults_5_2.rb run bundle install The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`. Fetching gem metadata from https://rubygems.org/......... Fetching gem metadata from https://rubygems.org/. Resolving dependencies... Fetching rake 12.3.1 Installing rake 12.3.1 Fetching concurrent-ruby 1.1.3 Installing concurrent-ruby 1.1.3 Fetching i18n 1.1.1 Installing i18n 1.1.1 Fetching minitest 5.11.3 Installing minitest 5.11.3 Fetching thread_safe 0.3.6 Installing thread_safe 0.3.6 Fetching tzinfo 1.2.5 Installing tzinfo 1.2.5 Fetching activesupport 5.2.1 Installing activesupport 5.2.1 Fetching builder 3.2.3 Installing builder 3.2.3 Fetching erubi 1.7.1 Installing erubi 1.7.1 Fetching mini_portile2 2.3.0 Installing mini_portile2 2.3.0 Fetching nokogiri 1.8.5 Installing nokogiri 1.8.5 with native extensions Fetching rails-dom-testing 2.0.3 Installing rails-dom-testing 2.0.3 Fetching crass 1.0.4 Installing crass 1.0.4 Fetching loofah 2.2.3 Installing loofah 2.2.3 Fetching rails-html-sanitizer 1.0.4 Installing rails-html-sanitizer 1.0.4 Fetching actionview 5.2.1 Installing actionview 5.2.1 Fetching rack 2.0.6 Installing rack 2.0.6 Fetching rack-test 1.1.0 Installing rack-test 1.1.0 Fetching actionpack 5.2.1 Installing actionpack 5.2.1 Fetching nio4r 2.3.1 Installing nio4r 2.3.1 with native extensions Fetching websocket-extensions 0.1.3 Installing websocket-extensions 0.1.3 Fetching websocket-driver 0.7.0 Installing websocket-driver 0.7.0 with native extensions Fetching actioncable 5.2.1 Installing actioncable 5.2.1 Fetching globalid 0.4.1 Installing globalid 0.4.1 Fetching activejob 5.2.1 Installing activejob 5.2.1 Fetching mini_mime 1.0.1 Installing mini_mime 1.0.1 Fetching mail 2.7.1 Installing mail 2.7.1 Fetching actionmailer 5.2.1 Installing actionmailer 5.2.1 Fetching activemodel 5.2.1 Installing activemodel 5.2.1 Fetching arel 9.0.0 Installing arel 9.0.0 Fetching activerecord 5.2.1 Installing activerecord 5.2.1 Fetching mimemagic 0.3.2 Installing mimemagic 0.3.2 Fetching marcel 0.3.3 Installing marcel 0.3.3 Fetching activestorage 5.2.1 Installing activestorage 5.2.1 Fetching public_suffix 3.0.3 Installing public_suffix 3.0.3 Fetching addressable 2.5.2 Installing addressable 2.5.2 Fetching io-like 0.3.0 Installing io-like 0.3.0 Fetching archive-zip 0.11.0 Installing archive-zip 0.11.0 Fetching bindex 0.5.0 Installing bindex 0.5.0 with native extensions Fetching msgpack 1.2.4 Installing msgpack 1.2.4 with native extensions Fetching bootsnap 1.3.2 Installing bootsnap 1.3.2 with native extensions Using bundler 1.17.1 Fetching byebug 10.0.2 Installing byebug 10.0.2 with native extensions Fetching regexp_parser 1.3.0 Installing regexp_parser 1.3.0 Fetching xpath 3.2.0 Installing xpath 3.2.0 Fetching capybara 3.11.0 Installing capybara 3.11.0 Fetching ffi 1.9.25 Installing ffi 1.9.25 with native extensions Fetching childprocess 0.9.0 Installing childprocess 0.9.0 Fetching chromedriver-helper 2.1.0 Installing chromedriver-helper 2.1.0 Fetching coffee-script-source 1.12.2 Installing coffee-script-source 1.12.2 Fetching execjs 2.7.0 Installing execjs 2.7.0 Fetching coffee-script 2.4.1 Installing coffee-script 2.4.1 Fetching method_source 0.9.2 Installing method_source 0.9.2 Fetching thor 0.20.3 Installing thor 0.20.3 Fetching railties 5.2.1 Installing railties 5.2.1 Fetching coffee-rails 4.2.2 Installing coffee-rails 4.2.2 Fetching multi_json 1.13.1 Installing multi_json 1.13.1 Fetching jbuilder 2.8.0 Installing jbuilder 2.8.0 Fetching rb-fsevent 0.10.3 Installing rb-fsevent 0.10.3 Fetching rb-inotify 0.9.10 Installing rb-inotify 0.9.10 Fetching ruby_dep 1.5.0 Installing ruby_dep 1.5.0 Fetching listen 3.1.5 Installing listen 3.1.5 Fetching puma 3.12.0 Installing puma 3.12.0 with native extensions Fetching sprockets 3.7.2 Installing sprockets 3.7.2 Fetching sprockets-rails 3.2.1 Installing sprockets-rails 3.2.1 Fetching rails 5.2.1 Installing rails 5.2.1 Fetching rubyzip 1.2.2 Installing rubyzip 1.2.2 Fetching sass-listen 4.0.0 Installing sass-listen 4.0.0 Fetching sass 3.7.2 Installing sass 3.7.2 Fetching tilt 2.0.8 Installing tilt 2.0.8 Fetching sass-rails 5.0.7 Installing sass-rails 5.0.7 Fetching selenium-webdriver 3.141.0 Installing selenium-webdriver 3.141.0 Fetching spring 2.0.2 Installing spring 2.0.2 Fetching spring-watcher-listen 2.0.1 Installing spring-watcher-listen 2.0.1 Fetching sqlite3 1.3.13 Installing sqlite3 1.3.13 with native extensions Fetching turbolinks-source 5.2.0 Installing turbolinks-source 5.2.0 Fetching turbolinks 5.2.0 Installing turbolinks 5.2.0 Fetching uglifier 4.1.19 Installing uglifier 4.1.19 Fetching web-console 3.7.0 Installing web-console 3.7.0 Bundle complete! 18 Gemfile dependencies, 79 gems now installed. Use `bundle info [gemname]` to see where a bundled gem is installed. Post-install message from sass: Ruby Sass is deprecated and will be unmaintained as of 26 March 2019. * If you use Sass as a command-line tool, we recommend using Dart Sass, the new primary implementation: https://sass-lang.com/install * If you use Sass as a plug-in for a Ruby web framework, we recommend using the sassc gem: https://github.com/sass/sassc-ruby#readme * For more details, please refer to the Sass blog: http://sass.logdown.com/posts/7081811 run bundle exec spring binstub --all * bin/rake: spring inserted * bin/rails: spring inserted
nokogiriのビルドに時間かかるね
さて、チュートリアルでは、Gemfileの中身を置き換えろと言っているので、置き換えてbundle installする。んー?この場合も--pathの設定は要るのだろうか?
というか、rails new で実行されたbundlerはどこにgemを入れたんだろう。
えっと、可能性としては、
くらいがあり得るのかな。難しいなあ。
で、探してみたら、どうやらrails newした時に実行されたbundle installは ~/.rbenv以下に入ったっぽい。ありゃー。
まあ、この辺りはもう悩んでも仕方ないので、もう一度hello_app以下でbundle installをパス指定で実行することにする。難しいなあ。
> bundle install --path=vender/bundle Fetching gem metadata from https://rubygems.org/.......... Fetching gem metadata from https://rubygems.org/. Resolving dependencies... Bundler could not find compatible versions for gem "actionpack": In snapshot (Gemfile.lock): actionpack (= 5.2.1) In Gemfile: rails (= 5.1.6) was resolved to 5.1.6, which depends on actionpack (= 5.1.6) coffee-rails (= 4.2.2) was resolved to 4.2.2, which depends on railties (>= 4.0.0) was resolved to 5.2.1, which depends on actionpack (= 5.2.1) Running `bundle update` will rebuild your snapshot from scratch, using only the gems in your Gemfile, which may resolve the conflict.
Gemfile.lockと合わないと怒られる。うーん、lock消すか。
> rm Gemfile.lock > bundle install --path=vender/bundle Fetching gem metadata from https://rubygems.org/.......... Fetching gem metadata from https://rubygems.org/. Resolving dependencies... Fetching rake 12.3.1 Installing rake 12.3.1 Fetching concurrent-ruby 1.1.3 Installing concurrent-ruby 1.1.3 Fetching i18n 1.1.1 Installing i18n 1.1.1 Fetching minitest 5.11.3 Installing minitest 5.11.3 Fetching thread_safe 0.3.6 Installing thread_safe 0.3.6 Fetching tzinfo 1.2.5 Installing tzinfo 1.2.5 Fetching activesupport 5.1.6 Installing activesupport 5.1.6 Fetching builder 3.2.3 Installing builder 3.2.3 Fetching erubi 1.7.1 Installing erubi 1.7.1 Fetching mini_portile2 2.3.0 Installing mini_portile2 2.3.0 Fetching nokogiri 1.8.5 Installing nokogiri 1.8.5 with native extensions Fetching rails-dom-testing 2.0.3 Installing rails-dom-testing 2.0.3 Fetching crass 1.0.4 Installing crass 1.0.4 Fetching loofah 2.2.3 Installing loofah 2.2.3 Fetching rails-html-sanitizer 1.0.4 Installing rails-html-sanitizer 1.0.4 Fetching actionview 5.1.6 Installing actionview 5.1.6 Fetching rack 2.0.6 Installing rack 2.0.6 Fetching rack-test 1.1.0 Installing rack-test 1.1.0 Fetching actionpack 5.1.6 Installing actionpack 5.1.6 Fetching nio4r 2.3.1 Installing nio4r 2.3.1 with native extensions Fetching websocket-extensions 0.1.3 Installing websocket-extensions 0.1.3 Fetching websocket-driver 0.6.5 Installing websocket-driver 0.6.5 with native extensions Fetching actioncable 5.1.6 Installing actioncable 5.1.6 Fetching globalid 0.4.1 Installing globalid 0.4.1 Fetching activejob 5.1.6 Installing activejob 5.1.6 Fetching mini_mime 1.0.1 Installing mini_mime 1.0.1 Fetching mail 2.7.1 Installing mail 2.7.1 Fetching actionmailer 5.1.6 Installing actionmailer 5.1.6 Fetching activemodel 5.1.6 Installing activemodel 5.1.6 Fetching arel 8.0.0 Installing arel 8.0.0 Fetching activerecord 5.1.6 Installing activerecord 5.1.6 Fetching bindex 0.5.0 Installing bindex 0.5.0 with native extensions Using bundler 1.17.1 Fetching byebug 9.0.6 Installing byebug 9.0.6 with native extensions Fetching coffee-script-source 1.12.2 Installing coffee-script-source 1.12.2 Fetching execjs 2.7.0 Installing execjs 2.7.0 Fetching coffee-script 2.4.1 Installing coffee-script 2.4.1 Fetching method_source 0.9.2 Installing method_source 0.9.2 Fetching thor 0.20.3 Installing thor 0.20.3 Fetching railties 5.1.6 Installing railties 5.1.6 Fetching coffee-rails 4.2.2 Installing coffee-rails 4.2.2 Fetching ffi 1.9.25 Installing ffi 1.9.25 with native extensions Fetching multi_json 1.13.1 Installing multi_json 1.13.1 Fetching jbuilder 2.6.4 Installing jbuilder 2.6.4 Fetching jquery-rails 4.3.1 Installing jquery-rails 4.3.1 Fetching rb-fsevent 0.10.3 Installing rb-fsevent 0.10.3 Fetching rb-inotify 0.9.10 Installing rb-inotify 0.9.10 Fetching ruby_dep 1.5.0 Installing ruby_dep 1.5.0 Fetching listen 3.1.5 Installing listen 3.1.5 Fetching puma 3.9.1 Installing puma 3.9.1 with native extensions Fetching sprockets 3.7.2 Installing sprockets 3.7.2 Fetching sprockets-rails 3.2.1 Installing sprockets-rails 3.2.1 Fetching rails 5.1.6 Installing rails 5.1.6 Fetching sass-listen 4.0.0 Installing sass-listen 4.0.0 Fetching sass 3.7.2 Installing sass 3.7.2 Fetching tilt 2.0.8 Installing tilt 2.0.8 Fetching sass-rails 5.0.6 Installing sass-rails 5.0.6 Fetching spring 2.0.2 Installing spring 2.0.2 Fetching spring-watcher-listen 2.0.1 Installing spring-watcher-listen 2.0.1 Fetching sqlite3 1.3.13 Installing sqlite3 1.3.13 with native extensions Fetching turbolinks-source 5.2.0 Installing turbolinks-source 5.2.0 Fetching turbolinks 5.0.1 Installing turbolinks 5.0.1 Fetching uglifier 3.2.0 Installing uglifier 3.2.0 Fetching web-console 3.5.1 Installing web-console 3.5.1 Bundle complete! 14 Gemfile dependencies, 64 gems now installed. Bundled gems are installed into `./vender/bundle` Post-install message from sass: Ruby Sass is deprecated and will be unmaintained as of 26 March 2019. * If you use Sass as a command-line tool, we recommend using Dart Sass, the new primary implementation: https://sass-lang.com/install * If you use Sass as a plug-in for a Ruby web framework, we recommend using the sassc gem: https://github.com/sass/sassc-ruby#readme * For more details, please refer to the Sass blog: http://sass.logdown.com/posts/7081811
できた。あれ?vendorをvenderにスペルミスしてる。くぅ・・・まあ、今回はもういいか。.bundle以下に--pathの設定は維持されるようだ。
> cat .bundle/config --- BUNDLE_PATH: "vender/bundle"
動かしてみる。
> bundle exec rails server Traceback (most recent call last): 14: from bin/rails:3:in `<main>' 13: from bin/rails:3:in `load' 12: from /Users/tambara/study/rails_study/hello_app/bin/spring:15:in `<top (required)>' 11: from /Users/tambara/study/rails_study/hello_app/bin/spring:15:in `require' 10: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>' 9: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load' 8: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/spring-2.0.2/bin/spring:49:in `<top (required)>' 7: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/client.rb:30:in `run' 6: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call' 5: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call' 4: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load' 3: from /Users/tambara/study/rails_study/hello_app/bin/rails:8:in `<top (required)>' 2: from /Users/tambara/study/rails_study/hello_app/bin/rails:8:in `require_relative' 1: from /Users/tambara/study/rails_study/hello_app/config/boot.rb:4:in `<top (required)>' /Users/tambara/study/rails_study/hello_app/config/boot.rb:4:in `require': cannot load such file -- bootsnap/setup (LoadError)
bootsnapが足りんと怒られるんじゃが・・・。
解決方法は、boot.rbのrequireを外すか、Gemfileにbootsnapを足すか、どちらかだと思う。ググってみた感じでは、boot.rbを修正するほうが簡単そう。いやー、こういうところが初心者殺しなんだろうねぇ。Cloud9は偉大だ。甘えてると知識が身につかないので、なんとか頑張ろう。
boot.rbを修正してみたら、やっぱりエラー
> bundle exec rails server Traceback (most recent call last): 26: from bin/rails:3:in `<main>' 25: from bin/rails:3:in `load' 24: from /Users/tambara/study/rails_study/hello_app/bin/spring:15:in `<top (required)>' 23: from /Users/tambara/study/rails_study/hello_app/bin/spring:15:in `require' 22: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>' 21: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load' 20: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/spring-2.0.2/bin/spring:49:in `<top (required)>' 19: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/client.rb:30:in `run' 18: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call' 17: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call' 16: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load' 15: from /Users/tambara/study/rails_study/hello_app/bin/rails:9:in `<top (required)>' 14: from /Users/tambara/study/rails_study/hello_app/bin/rails:9:in `require' 13: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/commands.rb:16:in `<top (required)>' 12: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/command.rb:44:in `invoke' 11: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/command/base.rb:63:in `perform' 10: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch' 9: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command' 8: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run' 7: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/commands/server/server_command.rb:130:in `perform' 6: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/commands/server/server_command.rb:130:in `tap' 5: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/commands/server/server_command.rb:133:in `block in perform' 4: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/commands/server/server_command.rb:133:in `require' 3: from /Users/tambara/study/rails_study/hello_app/config/application.rb:9:in `<top (required)>' 2: from /Users/tambara/study/rails_study/hello_app/config/application.rb:10:in `<module:HelloApp>' 1: from /Users/tambara/study/rails_study/hello_app/config/application.rb:12:in `<class:Application>' /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/application/configuration.rb:81:in `load_defaults': Unknown version "5.2" (RuntimeError)
これ、後からバージョン下げるの辛くない?
application.rbを見ると
> cat application.rb require_relative 'boot' require 'rails/all' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module HelloApp class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. config.load_defaults 5.2 # Settings in config/environments/* take precedence over those specified here. # Application configuration can go into files in config/initializers # -- all .rb files in that directory are automatically loaded after loading # the framework and any gems in your application. end end
よーわからんけど、5.2って書いてあっちゃいかん気がするので、5.1に書き換える
> bundle exec rails server => Booting Puma => Rails 5.1.6 application starting in development => Run `rails server -h` for more startup options Exiting Traceback (most recent call last): 69: from bin/rails:3:in `<main>' 68: from bin/rails:3:in `load' 67: from /Users/tambara/study/rails_study/hello_app/bin/spring:15:in `<top (required)>' 66: from /Users/tambara/study/rails_study/hello_app/bin/spring:15:in `require' 65: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>' 64: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load' 63: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/spring-2.0.2/bin/spring:49:in `<top (required)>' 62: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/client.rb:30:in `run' 61: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call' 60: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call' 59: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load' 58: from /Users/tambara/study/rails_study/hello_app/bin/rails:9:in `<top (required)>' 57: from /Users/tambara/study/rails_study/hello_app/bin/rails:9:in `require' 56: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/commands.rb:16:in `<top (required)>' 55: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/command.rb:44:in `invoke' 54: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/command/base.rb:63:in `perform' 53: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch' 52: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command' 51: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run' 50: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/commands/server/server_command.rb:130:in `perform' 49: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/commands/server/server_command.rb:130:in `tap' 48: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/commands/server/server_command.rb:135:in `block in perform' 47: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/commands/server/server_command.rb:42:in `start' 46: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/commands/server/server_command.rb:80:in `log_to_stdout' 45: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/rack-2.0.6/lib/rack/server.rb:354:in `wrapped_app' 44: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/commands/server/server_command.rb:24:in `app' 43: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/rack-2.0.6/lib/rack/server.rb:219:in `app' 42: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/rack-2.0.6/lib/rack/server.rb:319:in `build_app_and_options_from_config' 41: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/rack-2.0.6/lib/rack/builder.rb:40:in `parse_file' 40: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/rack-2.0.6/lib/rack/builder.rb:49:in `new_from_string' 39: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/rack-2.0.6/lib/rack/builder.rb:49:in `eval' 38: from config.ru:in `<main>' 37: from config.ru:in `new' 36: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/rack-2.0.6/lib/rack/builder.rb:55:in `initialize' 35: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/rack-2.0.6/lib/rack/builder.rb:55:in `instance_eval' 34: from config.ru:3:in `block in <main>' 33: from config.ru:3:in `require_relative' 32: from /Users/tambara/study/rails_study/hello_app/config/environment.rb:5:in `<top (required)>' 31: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/application.rb:353:in `initialize!' 30: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/initializable.rb:58:in `run_initializers' 29: from /Users/tambara/.rbenv/versions/2.5.1/lib/ruby/2.5.0/tsort.rb:205:in `tsort_each' 28: from /Users/tambara/.rbenv/versions/2.5.1/lib/ruby/2.5.0/tsort.rb:226:in `tsort_each' 27: from /Users/tambara/.rbenv/versions/2.5.1/lib/ruby/2.5.0/tsort.rb:347:in `each_strongly_connected_component' 26: from /Users/tambara/.rbenv/versions/2.5.1/lib/ruby/2.5.0/tsort.rb:347:in `call' 25: from /Users/tambara/.rbenv/versions/2.5.1/lib/ruby/2.5.0/tsort.rb:347:in `each' 24: from /Users/tambara/.rbenv/versions/2.5.1/lib/ruby/2.5.0/tsort.rb:349:in `block in each_strongly_connected_component' 23: from /Users/tambara/.rbenv/versions/2.5.1/lib/ruby/2.5.0/tsort.rb:415:in `each_strongly_connected_component_from' 22: from /Users/tambara/.rbenv/versions/2.5.1/lib/ruby/2.5.0/tsort.rb:415:in `call' 21: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/initializable.rb:48:in `tsort_each_child' 20: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/initializable.rb:48:in `each' 19: from /Users/tambara/.rbenv/versions/2.5.1/lib/ruby/2.5.0/tsort.rb:421:in `block in each_strongly_connected_component_from' 18: from /Users/tambara/.rbenv/versions/2.5.1/lib/ruby/2.5.0/tsort.rb:431:in `each_strongly_connected_component_from' 17: from /Users/tambara/.rbenv/versions/2.5.1/lib/ruby/2.5.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from' 16: from /Users/tambara/.rbenv/versions/2.5.1/lib/ruby/2.5.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component' 15: from /Users/tambara/.rbenv/versions/2.5.1/lib/ruby/2.5.0/tsort.rb:228:in `block in tsort_each' 14: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/initializable.rb:59:in `block in run_initializers' 13: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/initializable.rb:30:in `run' 12: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/initializable.rb:30:in `instance_exec' 11: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/engine.rb:599:in `block in <class:Engine>' 10: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/engine.rb:599:in `each' 9: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/engine.rb:600:in `block (2 levels) in <class:Engine>' 8: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require' 7: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:258:in `load_dependency' 6: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `block in require' 5: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require' 4: from /Users/tambara/study/rails_study/hello_app/config/environments/development.rb:1:in `<top (required)>' 3: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/railtie.rb:211:in `configure' 2: from /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/railtie.rb:211:in `instance_eval' 1: from /Users/tambara/study/rails_study/hello_app/config/environments/development.rb:31:in `block in <top (required)>' /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/railtie/configuration.rb:95:in `method_missing': undefined method `active_storage' for #<Rails::Application::Configuration:0x00007f982c959b80> (NoMethodError)
もう諦めて~/.rbenvのgemsで行きたい気になってきた。
これはたぶん、ActiveStorageを取ってきてないからだね。config/environments/development.rbのconfig.active_storage.service = :local
をコメントアウトする。
> bundle exec rails server => Booting Puma => Rails 5.1.6 application starting in development => Run `rails server -h` for more startup options Puma starting in single mode... * Version 3.9.1 (ruby 2.5.1-p57), codename: Private Caller * Min threads: 5, max threads: 5 * Environment: development * Listening on tcp://0.0.0.0:3000 Use Ctrl-C to stop
うごいたっぽ?
ブラウザでチェックしたら、エラーが出てる。
Puma caught this error: Missing `secret_key_base` for 'development' environment, set this value in `config/secrets.yml` (RuntimeError) /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/application.rb:510:in `validate_secret_key_config!' /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/application.rb:247:in `env_config' /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/engine.rb:692:in `build_request' /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/application.rb:518:in `build_request' /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/railties-5.1.6/lib/rails/engine.rb:521:in `call' /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/puma-3.9.1/lib/puma/configuration.rb:224:in `call' /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/puma-3.9.1/lib/puma/server.rb:602:in `handle_request' /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/puma-3.9.1/lib/puma/server.rb:435:in `process_client' /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/puma-3.9.1/lib/puma/server.rb:299:in `block in run' /Users/tambara/study/rails_study/hello_app/vender/bundle/ruby/2.5.0/gems/puma-3.9.1/lib/puma/thread_pool.rb:120:in `block in spawn_thread'
なんだよー。
ぐぐると、5.2でconfig/secrets.ymlはなくなって、config/credentials.yml.encになったらしい。たしかにcredentials.yml.encはある。なんか、キーっぽいものが入ってる。
適当なものを作る。
> cat config/secrets.yml development: secret_key_base: hoge
またエラー
undefined method `verbose_query_logs=' for ActiveRecord::Base:Class
これも5.2の新機能っぽ。この苦労要るのか?
development.rbのconfig.active_record.verbose_query_logs = true
をコメントアウトしてみる。
これでやっと、Welcomeページが出た。
route.rbを修正して、画面にhello, worldと出すのはすんなり。起動中でもちゃんと変わるのな。偉いな。
しかし、てこずった・・・