0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[rails]Webpacker configuration file not foundエラーの解決法

Posted at

環境

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
0
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?