[Ruby] [Beginner] I stumbled until I started the project with Rails 6

less than 1 minute read

Check the ruby version and install

$ ruby --version

If the version of ruby is 2.5.0 or higher, it will work. However, the latest version may have faster method addition and processing. 2.7.1 seems to be stable now.

# Install the latest ruby
$ rbenv install 2.7.1

Launching a project with rails6

$ mkdir sample_app
$ cd sample_app

# ruby version change
$ rbenv local 2.7.1

# rails6 install
$ gem install rails -v '6.0.0'

# Changing DB to PostgreSQL
$ rails _6.0.0_ new -d postgresql

$rails s

Stumble points

Normally it will start up above, but when using rails 6 for the first time

$ rails s

=> Booting Puma
=> Rails 6.0.0.rc2 application starting in development
=> Run `rails server --help` for more startup options

RAILS_ENV=development environment is not defined in config/webpacker.yml, falling back to production environment
Exiting
...
/home/ubuntu/.rvm/gems/ruby-2.6.3/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:91:in `rescue in load': Webpacker configuration file not found /home/ubuntu /environment/test-app1/config/webpacker.yml.
Please run rails webpacker:install Error: No such file or directory @ rb_sysopen-/home/ubuntu/environment/test-app1/config/webpacker.yml (RuntimeError)

I get this error: This is an error that webpacker could not be installed

$ rails webpacker:install

I will solve it. again,

$ rails s

If you carry out

Screenshots 2020-07-26 11.45.52.png