質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.35%
Ruby on Rails 5

Ruby on Rails 5は、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

解決済

2回答

728閲覧

Railsローカル環境の構築

ahiru3

総合スコア12

Ruby on Rails 5

Ruby on Rails 5は、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

0グッド

0クリップ

投稿2020/02/18 12:18

Railsのローカル環境構築がしたいです。

progateでruby,ruby on railsを学びWebサイトの作成をしたくローカル環境の構築時にエラーにな理実行できていない状況です。

自分で実行した事

1、progateでrubyの開発環境の用意

ruby -v

tarminal

1$ ruby -v 2ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin18]

・デスクトップ上で右クリックをし、「新規フォルダ」を選択して「ruby_lesson」という名前のフォルダを作成 
・ATOMで「ruby_lesson」フォルダ選択し、
「New File」を選択から「index.rb」と入力し、ファイルを作成
・「index.rb」にRubyのコードを記述

index

1puts "Hello, World!" 2puts 1 + 2

・コマンドを実行

tarminal

1$ cd ~/Desktop/ruby_lesson 2$ ruby index.rb 3Hello World 43

・Homebrewのインストール

tarminal

1$ brew -v 2Homebrew 2.2.5 3Homebrew/homebrew-core (git revision 6219; last commit 2020-02-14)

・rbenvのインストール

tarminal

1$ rbenv -v 2rbenv 1.1.2

・rbenvを使用してRubyをインストールする前にインストールしたrbenvの設定

tarminal

1$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile 2$ source ~/.bash_profile

・Rubyのインストール(rbenv global 2.5.0のrubyの使用)

tarminal

1$ rbenv versions 2 system 3 2.4.5 4* 2.5.0 (set by /Users/apple/.ruby-version)

Rubyの環境設定の完了

2、Ruby on Railsの環境構築
・Rubyのバージョンを確認

tarminal

1$ rbenv versions 2 system 3 2.4.5 4* 2.5.0 (set by /Users/apple/.ruby-version)

・Ruby on Railsをインストール

gem install rails -v "5.2.4.1"
rails -v

tarminal

1$ rails -v 2Rails 6.0.2.1

・ここで1つ疑問点・
gem install rails -v "5.2.4.1"でバージョンの指定をしたにも関わらず、

Rails 6.0.2.1となっているところ。

・Railsアプリケーションの作成
rails new sample_appでアプリケーションの作成

※ここで何度かやり直した際にsample_appが複数作成しています。
消した方が良いでしょうか。

tarminal

1$ ls 21000 Gemfile Pictures **sample_app** vendor 3Applications Gemfile.lock Public sample_app2 4Desktop Library false sample_app3 5Documents Movies leopa sample_app4 6Downloads Music sample true

sample_appが手順どおり作成したものですので、
sample_appで以降説明続けます。

・ローカルでRailsサーバを立てる

tarminal

1$ cd sample_app 2$ rails s 3[WARNING] Could not load command "rails/commands/server/server_command". Error: uninitialized constant URI::Generic. 4

という状況です。

以前の質問で確認実行した事

tarminal

1$ which ruby 2/Users/apple/.rbenv/shims/ruby 3 4$ gem install bundler 5Successfully installed bundler-2.1.4 6Parsing documentation for bundler-2.1.4 7Done installing documentation for bundler after 3 seconds 81 gem installed 9 10$ bundle install 11The Gemfile specifies no dependencies 12Bundle complete! 0 Gemfile dependencies, 1 gem now installed. 13Bundled gems are installed into `./vendor/bundle`

以前の質問でgemfile,gemfile.lockの中の確認をしました。

gemfile

1$source 'https://rubygems.org' 2git_source(:github) { |repo| "https://github.com/#{repo}.git" } 3 4ruby '2.5.0' 5 6# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 7gem 'rails', '~> 5.2.4', '>= 5.2.4.1' 8# Use sqlite3 as the database for Active Record 9gem 'sqlite3' 10# Use Puma as the app server 11gem 'puma', '~> 3.11' 12# Use SCSS for stylesheets 13gem 'sass-rails', '~> 5.0' 14# Use Uglifier as compressor for JavaScript assets 15gem 'uglifier', '>= 1.3.0' 16# See https://github.com/rails/execjs#readme for more supported runtimes 17# gem 'mini_racer', platforms: :ruby 18 19# Use CoffeeScript for .coffee assets and views 20gem 'coffee-rails', '~> 4.2' 21# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks 22gem 'turbolinks', '~> 5' 23# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 24gem 'jbuilder', '~> 2.5' 25# Use Redis adapter to run Action Cable in production 26# gem 'redis', '~> 4.0' 27# Use ActiveModel has_secure_password 28# gem 'bcrypt', '~> 3.1.7' 29 30# Use ActiveStorage variant 31# gem 'mini_magick', '~> 4.8' 32 33# Use Capistrano for deployment 34# gem 'capistrano-rails', group: :development 35 36# Reduces boot times through caching; required in config/boot.rb 37gem 'bootsnap', '>= 1.1.0', require: false 38 39group :development, :test do 40 # Call 'byebug' anywhere in the code to stop execution and get a debugger console 41 gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] 42end 43 44group :development do 45 # Access an interactive console on exception pages or by calling 'console' anywhere in the code. 46 gem 'web-console', '>= 3.3.0' 47 gem 'listen', '>= 3.0.5', '< 3.2' 48 # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 49 gem 'spring' 50 gem 'spring-watcher-listen', '~> 2.0.0' 51end 52 53group :test do 54 # Adds support for Capybara system testing and selenium driver 55 gem 'capybara', '>= 2.15' 56 gem 'selenium-webdriver' 57 # Easy installation and use of chromedriver to run system tests with Chrome 58 gem 'chromedriver-helper' 59end 60 61# Windows does not include zoneinfo files, so bundle the tzinfo-data gem 62gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 63

gemfile.lockは作成されていませんでした。

問題点もわからなくなり調べようがなくなってしまっています。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

hatsu

2020/02/18 16:53

gem list railsでローカルでInstall済みのRailsのバージョンを確認できたかと思います。 指定のバージョンでrails newを行いたい場合は rails _5.2.4.1_ new sample_app で可能です。またrails newコマンドの実行結果があるとより詳しい状況わかるので助かるかもです。
ahiru3

2020/02/18 20:37

## 疑問点まとめ ・`gem install rails -v "5.2.4.1"`でバージョンの指定をしたにも関わらず、 `Rails 6.0.2.1`となっているところ。 ・`gemfile.lock`は作成されていませんでした。 ## 依頼頂いた件 ・検証のため`rails new ~`を実行した結果です。 ```tarminal $ rails new leoppa 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/apple/leoppa/.git/ create package.json create app create app/assets/config/manifest.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/javascript/channels/consumer.js create app/javascript/channels/index.js create app/javascript/packs/application.js 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/controllers/concerns/.keep create app/models/concerns/.keep create bin create bin/rails create bin/rake create bin/setup 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 Traceback (most recent call last): 47: from /Users/apple/.rbenv/versions/2.5.0/bin/rails:23:in `<main>' 46: from /Users/apple/.rbenv/versions/2.5.0/bin/rails:23:in `load' 45: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-6.0.2.1/exe/rails:10:in `<top (required)>' 44: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require' 43: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require' 42: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-6.0.2.1/lib/rails/cli.rb:18:in `<top (required)>' 41: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-6.0.2.1/lib/rails/command.rb:46:in `invoke' 40: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-6.0.2.1/lib/rails/command/base.rb:69:in `perform' 39: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch' 38: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command' 37: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor/command.rb:27:in `run' 36: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-6.0.2.1/lib/rails/commands/application/application_command.rb:26:in `perform' 35: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor/base.rb:485:in `start' 34: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor/group.rb:232:in `dispatch' 33: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor/invocation.rb:134:in `invoke_all' 32: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor/invocation.rb:134:in `map' 31: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor/invocation.rb:134:in `each' 30: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor/invocation.rb:134:in `block in invoke_all' 29: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command' 28: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor/command.rb:27:in `run' 27: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-6.0.2.1/lib/rails/generators/rails/app/app_generator.rb:319:in `create_config_files' 26: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-6.0.2.1/lib/rails/generators/app_base.rb:156:in `build' 25: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-6.0.2.1/lib/rails/generators/rails/app/app_generator.rb:106:in `config' 24: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-6.0.2.1/lib/rails/generators/rails/app/app_generator.rb:19:in `inside' 23: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor/actions.rb:187:in `inside' 22: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/2.5.0/fileutils.rb:122:in `cd' 21: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/2.5.0/fileutils.rb:122:in `chdir' 20: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor/actions.rb:187:in `block in inside' 19: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-6.0.2.1/lib/rails/generators/rails/app/app_generator.rb:115:in `block in config' 18: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-6.0.2.1/lib/rails/generators/rails/app/app_generator.rb:19:in `directory' 17: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor/actions/directory.rb:52:in `directory' 16: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor/actions.rb:93:in `action' 15: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor/actions/directory.rb:66:in `invoke!' 14: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor/actions/directory.rb:80:in `execute!' 13: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor/actions/directory.rb:80:in `each' 12: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor/actions/directory.rb:92:in `block in execute!' 11: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor/actions/file_manipulation.rb:122:in `template' 10: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor/actions/create_file.rb:25:in `create_file' 9: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor/actions.rb:93:in `action' 8: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor/actions/create_file.rb:60:in `invoke!' 7: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor/actions/empty_directory.rb:117:in `invoke_with_conflict_check' 6: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor/actions/create_file.rb:63:in `block in invoke!' 5: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor/actions/create_file.rb:63:in `open' 4: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor/actions/create_file.rb:63:in `block (2 levels) in invoke!' 3: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor/actions/create_file.rb:53:in `render' 2: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/thor-1.0.1/lib/thor/actions/file_manipulation.rb:131:in `block in template' 1: from /Users/apple/.rbenv/versions/2.5.0/lib/ruby/2.5.0/erb.rb:885:in `result' /Users/apple/.rbenv/versions/2.5.0/lib/ruby/2.5.0/erb.rb:885:in `eval': /Users/apple/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/railties-6.0.2.1/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt:10: syntax error, unexpected ')', expecting end-of-input (SyntaxError) ); if spring_install? ``` また、`rails _5.2.4.1_ new sample_app`を実行した結果です。 ```tarminal $ rails _5.2.4.1_ new sample_app exist identical README.md identical Rakefile identical .ruby-version identical config.ru conflict .gitignore Overwrite /Users/apple/sample_app/.gitignore? (enter "h" for help) [Ynaqdhm] y force .gitignore identical Gemfile run git init from "." Reinitialized existing Git repository in /Users/apple/sample_app/.git/ identical package.json exist app identical app/assets/config/manifest.js identical app/assets/javascripts/application.js identical app/assets/javascripts/cable.js identical app/assets/stylesheets/application.css identical app/channels/application_cable/channel.rb identical app/channels/application_cable/connection.rb identical app/controllers/application_controller.rb identical app/helpers/application_helper.rb identical app/jobs/application_job.rb identical app/mailers/application_mailer.rb identical app/models/application_record.rb identical app/views/layouts/application.html.erb identical app/views/layouts/mailer.html.erb identical app/views/layouts/mailer.text.erb identical app/assets/images/.keep exist app/assets/javascripts/channels identical app/assets/javascripts/channels/.keep identical app/controllers/concerns/.keep identical app/models/concerns/.keep exist bin identical bin/bundle conflict bin/rails Overwrite /Users/apple/sample_app/bin/rails? (enter "h" for help) [Ynaqdhm] y force bin/rails conflict bin/rake Overwrite /Users/apple/sample_app/bin/rake? (enter "h" for help) [Ynaqdhm] ``` 上記となります。
hatsu

2020/02/19 00:59

rails new のログを見ると、こちらがまずうまく動いていないようです。 test.rb.tt:10: syntax error, unexpected ')', expecting end-of-input (SyntaxError) が出ていることから。 >gemfile.lock`は作成されていませんでした。 rails newのタイミングでGemfileの作成は行われていますが、先述の通り途中で失敗しているため本来行われるはずのBundle Installが行われていません。 rails _5.2.4.1_ new sample_app の場合、以前作ったsample_appを上書きしているため、まだ詳しくわからないですが、、 Overwrite /Users/apple/sample_app/bin/rake? (enter "h" for help) [Ynaqdhm] みたいなログから上書きしていることがわかります。
ahiru3

2020/02/19 20:41

$ rails _5.2.4.1_ new sample_app exist identical README.md identical Rakefile identical .ruby-version identical config.ru identical .gitignore identical Gemfile run git init from "." Reinitialized existing Git repository in /Users/apple/sample_app/.git/ identical package.json exist app identical app/assets/config/manifest.js identical app/assets/javascripts/application.js identical app/assets/javascripts/cable.js identical app/assets/stylesheets/application.css identical app/channels/application_cable/channel.rb identical app/channels/application_cable/connection.rb identical app/controllers/application_controller.rb identical app/helpers/application_helper.rb identical app/jobs/application_job.rb identical app/mailers/application_mailer.rb identical app/models/application_record.rb identical app/views/layouts/application.html.erb identical app/views/layouts/mailer.html.erb identical app/views/layouts/mailer.text.erb identical app/assets/images/.keep exist app/assets/javascripts/channels identical app/assets/javascripts/channels/.keep identical app/controllers/concerns/.keep identical app/models/concerns/.keep exist bin identical bin/bundle identical bin/rails conflict bin/rake Overwrite /Users/apple/sample_app/bin/rake? (enter "h" for help) [Ynaqdhm] y ⇦ここで上書き実行 force bin/rake identical bin/setup identical bin/update identical bin/yarn exist config identical config/routes.rb identical config/application.rb identical config/environment.rb identical config/cable.yml identical config/puma.rb identical config/spring.rb identical config/storage.yml exist config/environments identical config/environments/development.rb identical config/environments/production.rb identical config/environments/test.rb exist config/initializers identical config/initializers/application_controller_renderer.rb identical config/initializers/assets.rb identical config/initializers/backtrace_silencers.rb identical config/initializers/content_security_policy.rb identical config/initializers/cookies_serializer.rb create config/initializers/cors.rb identical config/initializers/filter_parameter_logging.rb identical config/initializers/inflections.rb identical config/initializers/mime_types.rb create config/initializers/new_framework_defaults_5_2.rb identical config/initializers/wrap_parameters.rb exist config/locales identical config/locales/en.yml append .gitignore identical config/boot.rb identical config/database.yml exist db identical db/seeds.rb exist lib exist lib/tasks identical lib/tasks/.keep exist lib/assets identical lib/assets/.keep exist log identical log/.keep exist public identical public/404.html identical public/422.html identical public/500.html identical public/apple-touch-icon-precomposed.png identical public/apple-touch-icon.png identical public/favicon.ico identical public/robots.txt exist tmp identical tmp/.keep exist tmp/pids identical tmp/pids/.keep exist tmp/cache exist tmp/cache/assets exist vendor identical vendor/.keep exist test/fixtures identical test/fixtures/.keep exist test/fixtures/files identical test/fixtures/files/.keep exist test/controllers identical test/controllers/.keep exist test/mailers identical test/mailers/.keep exist test/models identical test/models/.keep exist test/helpers identical test/helpers/.keep exist test/integration identical test/integration/.keep identical test/test_helper.rb exist test/system identical test/system/.keep identical test/application_system_test_case.rb exist storage identical storage/.keep exist tmp/storage identical 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`. Using rake 13.0.1 Using concurrent-ruby 1.1.5 Using i18n 1.8.2 Using minitest 5.14.0 Using thread_safe 0.3.6 Using tzinfo 1.2.6 Using activesupport 5.2.4.1 Using builder 3.2.4 Using erubi 1.9.0 Using mini_portile2 2.4.0 Using nokogiri 1.10.7 Using rails-dom-testing 2.0.3 Using crass 1.0.6 Using loofah 2.4.0 Using rails-html-sanitizer 1.3.0 Using actionview 5.2.4.1 Using rack 2.1.2 Using rack-test 1.1.0 Using actionpack 5.2.4.1 Using nio4r 2.5.2 Using websocket-extensions 0.1.4 Using websocket-driver 0.7.1 Using actioncable 5.2.4.1 Using globalid 0.4.2 Using activejob 5.2.4.1 Using mini_mime 1.0.2 Using mail 2.7.1 Using actionmailer 5.2.4.1 Using activemodel 5.2.4.1 Using arel 9.0.0 Using activerecord 5.2.4.1 Using mimemagic 0.3.4 Using marcel 0.3.3 Using activestorage 5.2.4.1 Using public_suffix 4.0.3 Using addressable 2.7.0 Using io-like 0.3.0 Using archive-zip 0.12.0 Using bindex 0.8.1 Using msgpack 1.3.3 Using bootsnap 1.4.5 Using bundler 2.1.4 Using byebug 11.1.1 Using regexp_parser 1.6.0 Using xpath 3.2.0 Using capybara 3.31.0 Using childprocess 3.0.0 Using chromedriver-helper 2.1.1 Using coffee-script-source 1.12.2 Using execjs 2.7.0 Using coffee-script 2.4.1 Using method_source 0.9.2 Using thor 1.0.1 Using railties 5.2.4.1 Using coffee-rails 4.2.2 Using ffi 1.12.2 Using jbuilder 2.9.1 Using rb-fsevent 0.10.3 Using rb-inotify 0.10.1 Using ruby_dep 1.5.0 Using listen 3.1.5 Using puma 3.12.2 Using sprockets 3.7.2 Using sprockets-rails 3.2.1 Using rails 5.2.4.1 Using rubyzip 2.2.0 Using sass-listen 4.0.0 Using sass 3.7.4 Using tilt 2.0.10 Using sass-rails 5.1.0 Using selenium-webdriver 3.142.7 Using spring 2.1.0 Using spring-watcher-listen 2.0.1 Using sqlite3 1.4.2 Using turbolinks-source 5.2.0 Using turbolinks 5.2.1 Using uglifier 4.2.0 Using web-console 3.7.0 Bundle complete! 18 Gemfile dependencies, 78 gems now installed. Bundled gems are installed into `./vendor/bundle` run bundle exec spring binstub --all bundler: failed to load command: spring (/Users/apple/sample_app/vendor/bundle/ruby/2.5.0/bin/spring) LoadError: cannot load such file -- bundler /Users/apple/sample_app/vendor/bundle/ruby/2.5.0/gems/spring-2.1.0/lib/spring/client/run.rb:3:in `require' /Users/apple/sample_app/vendor/bundle/ruby/2.5.0/gems/spring-2.1.0/lib/spring/client/run.rb:3:in `<top (required)>' /Users/apple/sample_app/vendor/bundle/ruby/2.5.0/gems/spring-2.1.0/lib/spring/client.rb:5:in `require' /Users/apple/sample_app/vendor/bundle/ruby/2.5.0/gems/spring-2.1.0/lib/spring/client.rb:5:in `<top (required)>' /Users/apple/sample_app/vendor/bundle/ruby/2.5.0/gems/spring-2.1.0/bin/spring:48:in `require' /Users/apple/sample_app/vendor/bundle/ruby/2.5.0/gems/spring-2.1.0/bin/spring:48:in `<top (required)>' /Users/apple/sample_app/vendor/bundle/ruby/2.5.0/bin/spring:23:in `load' /Users/apple/sample_app/vendor/bundle/ruby/2.5.0/bin/spring:23:in `<top (required)>' 上書きをするとこのようになりました。 syntaxエラーを調べたところ、 https://teratail.com/questions/221583 を参考にしようと思いrails _5.2.4.1_ new sample_app を実行しました。 bundler: failed to load command: spring (/Users/apple/sample_app/vendor/bundle/ruby/2.5.0/bin/spring) がエラーの原因でしょうか。
ahiru3

2020/02/19 20:47

bundlerのインストールがうまくいっていないとおもい以下を実行しました。 $ sudo gem install bundler Password: Successfully installed bundler-2.1.4 Parsing documentation for bundler-2.1.4 Done installing documentation for bundler after 2 seconds 1 gem installed 結果下記のエラーは解消されませんでした。 $ rails _5.2.4.1_ new sample_app exist identical README.md identical Rakefile identical .ruby-version identical config.ru conflict .gitignore Overwrite /Users/apple/sample_app/.gitignore? (enter "h" for help) [Ynaqdhm] y force .gitignore identical Gemfile run git init from "." Reinitialized existing Git repository in /Users/apple/sample_app/.git/ identical package.json exist app identical app/assets/config/manifest.js identical app/assets/javascripts/application.js identical app/assets/javascripts/cable.js identical app/assets/stylesheets/application.css identical app/channels/application_cable/channel.rb identical app/channels/application_cable/connection.rb identical app/controllers/application_controller.rb identical app/helpers/application_helper.rb identical app/jobs/application_job.rb identical app/mailers/application_mailer.rb identical app/models/application_record.rb identical app/views/layouts/application.html.erb identical app/views/layouts/mailer.html.erb identical app/views/layouts/mailer.text.erb identical app/assets/images/.keep exist app/assets/javascripts/channels identical app/assets/javascripts/channels/.keep identical app/controllers/concerns/.keep identical app/models/concerns/.keep exist bin identical bin/bundle identical bin/rails identical bin/rake identical bin/setup identical bin/update identical bin/yarn exist config identical config/routes.rb identical config/application.rb identical config/environment.rb identical config/cable.yml identical config/puma.rb identical config/spring.rb identical config/storage.yml exist config/environments identical config/environments/development.rb identical config/environments/production.rb identical config/environments/test.rb exist config/initializers identical config/initializers/application_controller_renderer.rb identical config/initializers/assets.rb identical config/initializers/backtrace_silencers.rb identical config/initializers/content_security_policy.rb identical config/initializers/cookies_serializer.rb create config/initializers/cors.rb identical config/initializers/filter_parameter_logging.rb identical config/initializers/inflections.rb identical config/initializers/mime_types.rb create config/initializers/new_framework_defaults_5_2.rb identical config/initializers/wrap_parameters.rb exist config/locales identical config/locales/en.yml append .gitignore identical config/boot.rb identical config/database.yml exist db identical db/seeds.rb exist lib exist lib/tasks identical lib/tasks/.keep exist lib/assets identical lib/assets/.keep exist log identical log/.keep exist public identical public/404.html identical public/422.html identical public/500.html identical public/apple-touch-icon-precomposed.png identical public/apple-touch-icon.png identical public/favicon.ico identical public/robots.txt exist tmp identical tmp/.keep exist tmp/pids identical tmp/pids/.keep exist tmp/cache exist tmp/cache/assets exist vendor identical vendor/.keep exist test/fixtures identical test/fixtures/.keep exist test/fixtures/files identical test/fixtures/files/.keep exist test/controllers identical test/controllers/.keep exist test/mailers identical test/mailers/.keep exist test/models identical test/models/.keep exist test/helpers identical test/helpers/.keep exist test/integration identical test/integration/.keep identical test/test_helper.rb exist test/system identical test/system/.keep identical test/application_system_test_case.rb exist storage identical storage/.keep exist tmp/storage identical 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`. Using rake 13.0.1 Using concurrent-ruby 1.1.5 Using i18n 1.8.2 Using minitest 5.14.0 Using thread_safe 0.3.6 Using tzinfo 1.2.6 Using activesupport 5.2.4.1 Using builder 3.2.4 Using erubi 1.9.0 Using mini_portile2 2.4.0 Using nokogiri 1.10.7 Using rails-dom-testing 2.0.3 Using crass 1.0.6 Using loofah 2.4.0 Using rails-html-sanitizer 1.3.0 Using actionview 5.2.4.1 Using rack 2.1.2 Using rack-test 1.1.0 Using actionpack 5.2.4.1 Using nio4r 2.5.2 Using websocket-extensions 0.1.4 Using websocket-driver 0.7.1 Using actioncable 5.2.4.1 Using globalid 0.4.2 Using activejob 5.2.4.1 Using mini_mime 1.0.2 Using mail 2.7.1 Using actionmailer 5.2.4.1 Using activemodel 5.2.4.1 Using arel 9.0.0 Using activerecord 5.2.4.1 Using mimemagic 0.3.4 Using marcel 0.3.3 Using activestorage 5.2.4.1 Using public_suffix 4.0.3 Using addressable 2.7.0 Using io-like 0.3.0 Using archive-zip 0.12.0 Using bindex 0.8.1 Using msgpack 1.3.3 Using bootsnap 1.4.5 Using bundler 2.1.4 Using byebug 11.1.1 Using regexp_parser 1.6.0 Using xpath 3.2.0 Using capybara 3.31.0 Using childprocess 3.0.0 Using chromedriver-helper 2.1.1 Using coffee-script-source 1.12.2 Using execjs 2.7.0 Using coffee-script 2.4.1 Using method_source 0.9.2 Using thor 1.0.1 Using railties 5.2.4.1 Using coffee-rails 4.2.2 Using ffi 1.12.2 Using jbuilder 2.9.1 Using rb-fsevent 0.10.3 Using rb-inotify 0.10.1 Using ruby_dep 1.5.0 Using listen 3.1.5 Using puma 3.12.2 Using sprockets 3.7.2 Using sprockets-rails 3.2.1 Using rails 5.2.4.1 Using rubyzip 2.2.0 Using sass-listen 4.0.0 Using sass 3.7.4 Using tilt 2.0.10 Using sass-rails 5.1.0 Using selenium-webdriver 3.142.7 Using spring 2.1.0 Using spring-watcher-listen 2.0.1 Using sqlite3 1.4.2 Using turbolinks-source 5.2.0 Using turbolinks 5.2.1 Using uglifier 4.2.0 Using web-console 3.7.0 Bundle complete! 18 Gemfile dependencies, 78 gems now installed. Bundled gems are installed into `./vendor/bundle` run bundle exec spring binstub --all bundler: failed to load command: spring (/Users/apple/sample_app/vendor/bundle/ruby/2.5.0/bin/spring) LoadError: cannot load such file -- bundler /Users/apple/sample_app/vendor/bundle/ruby/2.5.0/gems/spring-2.1.0/lib/spring/client/run.rb:3:in `require' /Users/apple/sample_app/vendor/bundle/ruby/2.5.0/gems/spring-2.1.0/lib/spring/client/run.rb:3:in `<top (required)>' /Users/apple/sample_app/vendor/bundle/ruby/2.5.0/gems/spring-2.1.0/lib/spring/client.rb:5:in `require' /Users/apple/sample_app/vendor/bundle/ruby/2.5.0/gems/spring-2.1.0/lib/spring/client.rb:5:in `<top (required)>' /Users/apple/sample_app/vendor/bundle/ruby/2.5.0/gems/spring-2.1.0/bin/spring:48:in `require' /Users/apple/sample_app/vendor/bundle/ruby/2.5.0/gems/spring-2.1.0/bin/spring:48:in `<top (required)>' /Users/apple/sample_app/vendor/bundle/ruby/2.5.0/bin/spring:23:in `load' /Users/apple/sample_app/vendor/bundle/ruby/2.5.0/bin/spring:23:in `<top (required)>'
hatsu

2020/02/19 22:55

>bundler: failed to load command: spring >(/Users/apple/sample_app/vendor/bundle/ruby/2.5.0/bin/spring) >がエラーの原因でしょうか。 はい、そうだと思います。
guest

回答2

0

ベストアンサー

ruby2.5.0が原因であるという情報を見つけました
https://stackoverflow.com/questions/59961343/failing-to-start-up-default-rails-server

rubyのバージョンを2.5.7にして試すとどうなりますか?

投稿2020/03/03 15:23

sink66

総合スコア88

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

bundler: failed to load command: spring
(/Users/apple/sample_app/vendor/bundle/ruby/2.5.0/bin/spring)

が原因そうです。

bash

1rails _5.2.4.1_ new sample_app --skip-bundle

とすることで、rails newのタイミングでは bundle installを行わいように設定できます。
rails newが完了後、

bash

1$ cd sample_sapp 2$ bundle install --path vendor/bundle

と行ってみてください。
これでgemのinstall先をvendor/bundle配下に置くことができます。

投稿2020/02/19 23:03

hatsu

総合スコア1809

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

ahiru3

2020/02/20 14:04

$ rails _5.2.4.1_ new sample_app --skip-bundle exist identical README.md identical Rakefile identical .ruby-version identical config.ru conflict .gitignore Overwrite /Users/apple/sample_app/.gitignore? (enter "h" for help) [Ynaqdhm] y force .gitignore identical Gemfile run git init from "." Reinitialized existing Git repository in /Users/apple/sample_app/.git/ identical package.json exist app identical app/assets/config/manifest.js identical app/assets/javascripts/application.js identical app/assets/javascripts/cable.js identical app/assets/stylesheets/application.css identical app/channels/application_cable/channel.rb identical app/channels/application_cable/connection.rb identical app/controllers/application_controller.rb identical app/helpers/application_helper.rb identical app/jobs/application_job.rb identical app/mailers/application_mailer.rb identical app/models/application_record.rb identical app/views/layouts/application.html.erb identical app/views/layouts/mailer.html.erb identical app/views/layouts/mailer.text.erb identical app/assets/images/.keep exist app/assets/javascripts/channels identical app/assets/javascripts/channels/.keep identical app/controllers/concerns/.keep identical app/models/concerns/.keep exist bin identical bin/bundle identical bin/rails identical bin/rake identical bin/setup identical bin/update identical bin/yarn exist config identical config/routes.rb identical config/application.rb identical config/environment.rb identical config/cable.yml identical config/puma.rb identical config/spring.rb identical config/storage.yml exist config/environments identical config/environments/development.rb identical config/environments/production.rb identical config/environments/test.rb exist config/initializers identical config/initializers/application_controller_renderer.rb identical config/initializers/assets.rb identical config/initializers/backtrace_silencers.rb identical config/initializers/content_security_policy.rb identical config/initializers/cookies_serializer.rb create config/initializers/cors.rb identical config/initializers/filter_parameter_logging.rb identical config/initializers/inflections.rb identical config/initializers/mime_types.rb create config/initializers/new_framework_defaults_5_2.rb identical config/initializers/wrap_parameters.rb exist config/locales identical config/locales/en.yml append .gitignore identical config/boot.rb identical config/database.yml exist db identical db/seeds.rb exist lib exist lib/tasks identical lib/tasks/.keep exist lib/assets identical lib/assets/.keep exist log identical log/.keep exist public identical public/404.html identical public/422.html identical public/500.html identical public/apple-touch-icon-precomposed.png identical public/apple-touch-icon.png identical public/favicon.ico identical public/robots.txt exist tmp identical tmp/.keep exist tmp/pids identical tmp/pids/.keep exist tmp/cache exist tmp/cache/assets exist vendor identical vendor/.keep exist test/fixtures identical test/fixtures/.keep exist test/fixtures/files identical test/fixtures/files/.keep exist test/controllers identical test/controllers/.keep exist test/mailers identical test/mailers/.keep exist test/models identical test/models/.keep exist test/helpers identical test/helpers/.keep exist test/integration identical test/integration/.keep identical test/test_helper.rb exist test/system identical test/system/.keep identical test/application_system_test_case.rb exist storage identical storage/.keep exist tmp/storage identical tmp/storage/.keep remove config/initializers/cors.rb remove config/initializers/new_framework_defaults_5_2.rb となり問題なさそうです。 $ cd sample_app $ bundle install --path vendor/bundle [DEPRECATED] The `--path` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set path 'vendor/bundle'`, and stop using this flag 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`. Using rake 13.0.1 Using concurrent-ruby 1.1.5 Using i18n 1.8.2 Using minitest 5.14.0 Using thread_safe 0.3.6 Using tzinfo 1.2.6 Using activesupport 5.2.4.1 Using builder 3.2.4 Using erubi 1.9.0 Using mini_portile2 2.4.0 Using nokogiri 1.10.7 Using rails-dom-testing 2.0.3 Using crass 1.0.6 Using loofah 2.4.0 Using rails-html-sanitizer 1.3.0 Using actionview 5.2.4.1 Using rack 2.1.2 Using rack-test 1.1.0 Using actionpack 5.2.4.1 Using nio4r 2.5.2 Using websocket-extensions 0.1.4 Using websocket-driver 0.7.1 Using actioncable 5.2.4.1 Using globalid 0.4.2 Using activejob 5.2.4.1 Using mini_mime 1.0.2 Using mail 2.7.1 Using actionmailer 5.2.4.1 Using activemodel 5.2.4.1 Using arel 9.0.0 Using activerecord 5.2.4.1 Using mimemagic 0.3.4 Using marcel 0.3.3 Using activestorage 5.2.4.1 Using public_suffix 4.0.3 Using addressable 2.7.0 Using io-like 0.3.0 Using archive-zip 0.12.0 Using bindex 0.8.1 Using msgpack 1.3.3 Using bootsnap 1.4.5 Using bundler 2.1.4 Using byebug 11.1.1 Using regexp_parser 1.6.0 Using xpath 3.2.0 Using capybara 3.31.0 Using childprocess 3.0.0 Using chromedriver-helper 2.1.1 Using coffee-script-source 1.12.2 Using execjs 2.7.0 Using coffee-script 2.4.1 Using method_source 0.9.2 Using thor 1.0.1 Using railties 5.2.4.1 Using coffee-rails 4.2.2 Using ffi 1.12.2 Using jbuilder 2.9.1 Using rb-fsevent 0.10.3 Using rb-inotify 0.10.1 Using ruby_dep 1.5.0 Using listen 3.1.5 Using puma 3.12.2 Using sprockets 3.7.2 Using sprockets-rails 3.2.1 Using rails 5.2.4.1 Using rubyzip 2.2.0 Using sass-listen 4.0.0 Using sass 3.7.4 Using tilt 2.0.10 Using sass-rails 5.1.0 Using selenium-webdriver 3.142.7 Using spring 2.1.0 Using spring-watcher-listen 2.0.1 Using sqlite3 1.4.2 Using turbolinks-source 5.2.0 Using turbolinks 5.2.1 Using uglifier 4.2.0 Using web-console 3.7.0 Bundle complete! 18 Gemfile dependencies, 78 gems now installed. Bundled gems are installed into `./vendor/bundle` ここまでは順調な感じです。 試しに以下実行してみましたところ $ rails s [WARNING] Could not load command "rails/commands/server/server_command". Error: uninitialized constant URI::Generic. のエラーになりました。 https://teratail.com/questions/229914 上記を参考に一度ターミナルの終了をし再度 $ cd sample_app $ rails server 実行しても同じエラーとなってしましました。
hatsu

2020/02/20 14:10

なるほどです。詳細なログありがとうございます。 ps auwx | grep puma をターミナルで打つとなんて出ますでしょうか? これはPuma(rails sを動かしているもの)が起動しているかを確認するものです。 また少し調べると、あまり的確な回答はないですが、ターミナルを一度閉じたら解決したとの回答が載っていました。ターミナルを閉じる、PCの再起動なども有効な手かもしれません。 https://teratail.com/questions/229914
ahiru3

2020/02/20 14:17

$ ps auwx | grep puma apple 3630 0.0 0.0 4288080 516 s000 U+ 11:16PM 0:00.00 grep puma このようになっています。 再起動もしてみます。
ahiru3

2020/02/20 14:56

再起動をしても同じでした。 うーん。調べても解決しないです。
hatsu

2020/02/21 10:34

解決しないですか。。。 bundle exec rails s だといかがでしょうか? bundle exec をつけることでGemfile.lockにあるGemのバージョンでrailsを起動することができます。 sample_appのGemfile.lockdではrailsが5.2.4.1、対してPCのグローバルのGemでは6系を使っているといった差分が見受けられましたので。
ahiru3

2020/02/22 20:36

$ cd sample_app $ bundle exec rails s [WARNING] Could not load command "rails/commands/server/server_command". Error: uninitialized constant URI::Generic. 同じでした。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.35%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問