環境
Rails 6.0.3.1
Vagrant 2.2.4
CentOS Linux release 7.7.1908 (Core)
サーバを立ち上げると謎のエラーが
$rails s -b 0.0.0.0
Webpacker configuration file not found /home/vagrant/work/arigatou/config/webpacker.yml.
Please run rails webpacker:install
Error: No such file or directory @ rb_sysopen - /home/vagrant/work/arigatou/config/webpacker.yml
(RuntimeError)
どうやら「rails webpacker:install」を打てと書かれているので、やってみます。
$ rails webpacker:install
Yarn not installed.
Please download and install Yarn from https://yarnpkg.com/lang/en/docs/install/
すると、「Yarn」をインストールしてくださいと出てきたので、インストールします。
$sudo npm install -g yarn
念のため、本当にインストールされているか確認。
$yarn -v
1.22.5
Yarnがインストールされたので、再度「rails webpacker:install」を実行。
インストールが完了したことを確認できました。
$rails webpacker:install
(省略)
Done in 68.20s.
Webpacker successfully installed 🎉 🍰
これでサーバーを起動すると問題なく動きます。。
$rails s -b 0.0.0.0
=> Booting Puma
=> Rails 6.0.3.2 application starting in development
=> Run `rails server --help` for more startup options
Puma starting in single mode...
* Version 4.3.6 (ruby 2.5.7-p206), codename: Mysterious Traveller
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://0.0.0.0:3000
Use Ctrl-C to stop