webpacker: Running `bundle exec rake webpacker:install` gives error: `Webpacker configuration file not found /vagrant_host_beeline/config/webpacker.yml. Please run rails webpacker:install Error: No such file or directory @ rb_sysopen - `

The first time I tried to run webpacker:install, it told me that my version of yarn was out of date, so I updated it. Then, I re-ran webpacker:install and got this message. I assume I’m doing something wrong, as the install script appears to be copying the webpacker.yml that it’s later complaining about. I’m a Rails newb, so me making a mistake is pretty likely…

$ bundle exec rake webpacker:install
rake aborted!
Webpacker configuration file not found /vagrant_host_beeline/config/webpacker.yml. Please run rails webpacker:install Error: No such file or directory @ rb_sysopen - /vagrant_host_beeline/config/webpacker.yml
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/webpacker-3.0.2/lib/webpacker/configuration.rb:65:in `rescue in load'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/webpacker-3.0.2/lib/webpacker/configuration.rb:62:in `load'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/webpacker-3.0.2/lib/webpacker/configuration.rb:9:in `refresh'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/webpacker-3.0.2/lib/webpacker/commands.rb:14:in `bootstrap'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/webpacker-3.0.2/lib/webpacker.rb:18:in `bootstrap'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/webpacker-3.0.2/lib/webpacker/railtie.rb:37:in `block in <class:Engine>'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/railties-4.2.4/lib/rails/initializable.rb:30:in `instance_exec'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/railties-4.2.4/lib/rails/initializable.rb:30:in `run'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/railties-4.2.4/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/railties-4.2.4/lib/rails/initializable.rb:54:in `run_initializers'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/railties-4.2.4/lib/rails/application.rb:352:in `initialize!'
/vagrant_host_beeline/config/environment.rb:5:in `<top (required)>'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `block in require'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/railties-4.2.4/lib/rails/application.rb:328:in `require_environment!'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/railties-4.2.4/lib/rails/application.rb:457:in `block in run_tasks_blocks'
Errno::ENOENT: No such file or directory @ rb_sysopen - /vagrant_host_beeline/config/webpacker.yml
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/webpacker-3.0.2/lib/webpacker/configuration.rb:62:in `read'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/webpacker-3.0.2/lib/webpacker/configuration.rb:62:in `read'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/webpacker-3.0.2/lib/webpacker/configuration.rb:62:in `load'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/webpacker-3.0.2/lib/webpacker/configuration.rb:9:in `refresh'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/webpacker-3.0.2/lib/webpacker/commands.rb:14:in `bootstrap'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/webpacker-3.0.2/lib/webpacker.rb:18:in `bootstrap'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/webpacker-3.0.2/lib/webpacker/railtie.rb:37:in `block in <class:Engine>'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/railties-4.2.4/lib/rails/initializable.rb:30:in `instance_exec'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/railties-4.2.4/lib/rails/initializable.rb:30:in `run'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/railties-4.2.4/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/railties-4.2.4/lib/rails/initializable.rb:54:in `run_initializers'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/railties-4.2.4/lib/rails/application.rb:352:in `initialize!'
/vagrant_host_beeline/config/environment.rb:5:in `<top (required)>'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `block in require'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/railties-4.2.4/lib/rails/application.rb:328:in `require_environment!'
/home/vagrant/.rvm/gems/ruby-2.3.1/gems/railties-4.2.4/lib/rails/application.rb:457:in `block in run_tasks_blocks'
Tasks: TOP => rails:template => environment
(See full trace by running task with --trace)

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 28 (7 by maintainers)

Most upvoted comments

I suspect you are running an instance of spring in one of your terminal windows. Spring loads classes and caches them in an aggressive way which can get the current set of available classes to be out of sync with your setup. When spring is running the bootstrap process is triggered within webpacker and somewhere in there it requires the webpacker.yml to already be present. I would suggest ensuring all of your instances of spring are killed. Then you can try again with the bundle exec rake webpacker:install command. Or, you can also directly call rake with rake webpacker:install. It’s not required that you use bundle exec but using that command ensures that rake will be run in the context of the configured gems. That’s not usually necessary to worry about on your local machine, so I usually don’t even bother. It would seem though that by using bundle exec you are tapping into the spring set of cached gems.

Hope that helps!

I fix created that file using command line, so this worked for me on Ruby on Rails 4.2 app

curl https://raw.githubusercontent.com/rails/webpacker/master/lib/install/config/webpacker.yml > config/webpacker.yml
bundle exec rake webpacker:install

Well, after reading through the code, it does indeed look like the config.yml file needs to be there in order to run the installation script, but the installation script is in charge of copying the config.yml file into the right place, so something is amiss…

I got around it by copying the webpacker.yml into config before running the installation command, and that allowed me to get past the error. https://raw.githubusercontent.com/rails/webpacker/master/lib/install/config/webpacker.yml

I still presume I’m doing something wrong, but I couldn’t figure out what it was.

I’m having the same issue with Rails 5.0.x. It was not spring related for me, as I stopped spring and when that didn’t work, I tried again from a fresh reboot just in case.

It must be a relatively new issue, because I tested installing webpacker on this same project just a couple of months ago without any problems.

The workaround of copying https://raw.githubusercontent.com/rails/webpacker/master/lib/install/config/webpacker.yml to my config folder worked for me.

Hi @Taytay

Did you try running the main installer first: See Here

$ bundle exec rails webpacker:install

Also having this problem, Rails 5 app, added

gem 'webpacker', '~> 3.2'

to Gemfile and ran

 $ bundle exec rails webpacker:install:react

got:

Configuration config/webpacker.yml file not found. 
Make sure webpacker:install is run successfully before running dependent tasks

Gemfile fragment:

ruby '2.3.4'
gem 'rails', '~> 5.0.2'

In Rails 5.0, I ran bundle exec rails webpacker:install, this builds the webpacker.yml file and fixes the error. Just remember to restart your rails server to see the changes.

same here. I’m on a brand new rails 5.2 project (tried a rails 6.0 after too which has the same problem).

running @duleorlovic’s fix seemed to work.