learn-co-curriculum / rails-application-basics-readme

Other
3 stars 234 forks source link

Webpacker configuration file not found #19

Open gnappo1 opened 4 years ago

gnappo1 commented 4 years ago

Starting with Rails 6, Webpacker is the default JavaScript compiler. It means that all the JavaScript code will be handled by Webpacker instead of the old assets pipeline (Sprockets). If you see the following error when running rails s:

Webpacker configuration file not found /Users/YOUR_USERNAME/blog-flash/config/webpacker.yml. Please run rails webpacker:install Error: No such file or directory @ rb_sysopen - /Users/YOUR_USERNAME/blog-flash/config/webpacker.yml (RuntimeError)

Try their suggestion: Please run: rails webpacker:install. If that command raises the error:

Yarn not installed. Please download and install Yarn from https://yarnpkg.com/lang/en/docs/install/

Install Yarn using the link suggested: https://yarnpkg.com/lang/en/docs/install/.

Issues with Yarn: Sometimes students have a yarn gem that seems to interfere with the javascript package. which yarn will tell you where yarn is. If it's showing up in some ruby gems folder, uninstall the yarn gem:gem uninstall yarn and Y if it asks to also remove the executable. Then install the javascript package of yarn globally: npm install -g yarn

Note that Node should also be installed, you can quickly check if it is by typing node -v in your terminal of preference. In general, I recommend installing nvm Node Version Manager, so that you'll be able to install multiple versions of Node and switch between them easily. Like rvm for Ruby!

Installation code for NVM: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.1/install.sh | bash Installation code for Node using NVM: nvm install node

Now that all the missing pieces are installed, let's try to run again rails webpacker:install.

If you still run into issues, try the following steps:

  1. Install webpacker using npm by running this command: npm i @rails/webpacker

  2. Run bundle install Note: You may need to eliminate the version designation. If so, do the following:

    • In your Gemfile: change the line with the webpacker gem into: gem webpacker
    • Delete the gemfile.lock file
    • Run bundle install
  3. Manually add a file called webpacker.yml to the config directory (final path: ./config/webpacker.yml).

  4. Add this text to the webpacker.yml file:

    development:
    dev_server:
      host: localhost
      port: 3000

If you do still have issues, wow good job for trying all of this first of all!!! But also, what a day ha?! Ask a question on AAQ and one of us coaches will try their best to find another solution that works for you!

Also, big shout out to @Ashley and @kenlyn for compiling these steps for all of us!

akrama23 commented 4 years ago

Thank you this helped me out

nicsiv commented 3 years ago

It helped me as well!

brandon-rodriguez commented 3 years ago

Thank youuuu!!!

markhilkert commented 3 years ago

FINALLY, ran into this issue so many times, this solved it.

dbrandt1990 commented 3 years ago

Yes!! the last bit is what worked for me.

SantanaJonathan commented 3 years ago

Sirvio de mucho, thanks Sir.

usershabanov commented 3 years ago

can't display hello world... spent whole day to solve this problem and nothing works Webpacker::Manifest::MissingEntryError in Articles#index https://guides.rubyonrails.org/getting_started.html moving this guide step by step

vlad71123 commented 2 years ago

большое спасибо, все работает