LoginSignup
0
0

More than 3 years have passed since last update.

mac で コマンド$ bundle exec rails new アプリ名 を実行した時にエラーが出た話

Posted at

目的

  • railsでアプリを作成する時のコマンド$ bundle exec rails new アプリ名を実行した時に出たエラーの解決方法をまとめる。

経緯

  • railsのアプリを新規作成しようとしてコマンド$ bundle exec rails new アプリ名を実行した時、ログの最後の五行にエラーらしき文字があった。
  • 筆者が作成したアプリ名は「aquariumPlanning」である。(みなさんのアプリ名に読み替えていただきたい。)
  • 下記にコマンド実行時のエラーを記載する。
$ bundle exec rails new aquariumPlanning --database=mysql
      create  
      create  README.md
      create  Rakefile
      create  .ruby-version
      create  config.ru
      create  .gitignore
      create  Gemfile
         run  git init from "."
                    ・
                    ・
                    ・
Bundle complete! 17 Gemfile dependencies, 75 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
         run  bundle binstubs bundler
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`.
         run  bundle exec spring binstub --all
* bin/rake: Spring inserted
* bin/rails: Spring inserted
       rails  webpacker:install
Traceback (most recent call last):
        3: from bin/rails:8:in `<main>'
        2: from bin/rails:8:in `require_relative'
        1: from /Users/admin/Documents/study/ruby_on_rails/org/aquariumPlanning/config/boot.rb:4:in `<top (required)>'
/Users/admin/Documents/study/ruby_on_rails/org/aquariumPlanning/config/boot.rb:4:in `require': cannot load such file -- bootsnap/setup (LoadError)

解決方法

  1. 下記コマンドを順に実行する。
$ cd アプリ名
$ bundle exec rails webpacker:install
$ rails server

※DBMSをMySQLに指定して新しいアプリを作成すると$ rails server後にブラウザを確認するとブラウザにActiveRecord::NoDatabaseErrorのようなエラーが出るはずである。前述の解決方法は別途記事にして本記事にリンクを張る予定である。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0