gemfileをいじったにも関わらず、
なぜか以下のようにエラーが表示される時の対処法
ec2-user:~/environment/taskleaf (master) $ bin/rails g model Task name:string description:text
Could not find gem 'bootstrap' in any of the gem sources listed in your Gemfile.
Run `bundle install` to install missing gems.
このように表示されるので、まずはbundle installを行います。
ec2-user:~/environment/taskleaf (master) $ 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...
Using rake 12.3.3
Using concurrent-ruby 1.1.5
Using i18n 1.6.0
Using minitest 5.11.3
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using activesupport 5.2.3
Using builder 3.2.3
Using erubi 1.8.0
Using mini_portile2 2.4.0
Using nokogiri 1.10.4
Using rails-dom-testing 2.0.3
Using crass 1.0.4
Using loofah 2.2.3
Using rails-html-sanitizer 1.2.0
Using actionview 5.2.3
Using rack 2.0.7
Using rack-test 1.1.0
Using actionpack 5.2.3
Using nio4r 2.4.0
Using websocket-extensions 0.1.4
Using websocket-driver 0.7.1
Using actioncable 5.2.3
Using globalid 0.4.2
Using activejob 5.2.3
Using mini_mime 1.0.2
Using mail 2.7.1
Using actionmailer 5.2.3
Using activemodel 5.2.3
Using arel 9.0.0
Using activerecord 5.2.3
Using mimemagic 0.3.3
Using marcel 0.3.3
Using activestorage 5.2.3
Using execjs 2.7.0
Using autoprefixer-rails 9.6.1
Using bindex 0.8.1
Using msgpack 1.3.1
Using bootsnap 1.4.4
Using popper_js 1.14.5
Using method_source 0.9.2
Using thor 0.20.3
Using railties 5.2.3
Using ffi 1.11.1
Using sassc 2.0.1
Using sprockets 3.7.2
Using sprockets-rails 3.2.1
Using tilt 2.0.9
Fetching sassc-rails 2.1.2
Installing sassc-rails 2.1.2
Fetching bootstrap 4.3.1
Installing bootstrap 4.3.1
Using bundler 2.0.2
Using byebug 11.0.1
Using coffee-script-source 1.12.2
Using coffee-script 2.4.1
Using coffee-rails 4.2.2
Using hpricot 0.8.6
Using html2slim 0.2.0
Using jbuilder 2.9.1
Using rb-fsevent 0.10.3
Using rb-inotify 0.10.0
Using ruby_dep 1.5.0
Using listen 3.1.5
Using mysql2 0.5.2
Using puma 3.12.1
Using rails 5.2.3
Using sass-listen 4.0.0
Using sass 3.7.4
Using sass-rails 5.0.7
Using temple 0.8.1
Using slim 4.0.1
Using slim-rails 3.2.0
Using spring 2.1.0
Using spring-watcher-listen 2.0.1
Using turbolinks-source 5.2.0
Using turbolinks 5.2.0
Using uglifier 4.1.20
Using web-console 3.7.0
Bundle complete! 18 Gemfile dependencies, 77 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
そのあと、書かれている文字の通りなので、そのまま打ち込みます!
ec2-user:~/environment/taskleaf (master) $ bundle info [gemname]
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`.
Could not find gem '[gemname]'.
これでうまくいきます。
ec2-user:~/environment/taskleaf (master) $ bin/rails g model Task name:string description:text
invoke active_record
create db/migrate/20190812073325_create_tasks.rb
create app/models/task.rb