0

I'm trying to 'rails server' and I get this :

/var/lib/gems/2.7.0/gems/webpacker-5.4.0/lib/webpacker/configuration.rb:103:in `rescue in load': Webpacker configuration file not found /home/hossein/Downloads/Projects/RubyProjects/work/demo/config/webpacker.yml. Please run rails webpacker:install Error: No such file or directory @ rb_check_realpath_internal - /home/hossein/Downloads/Projects/RubyProjects/work/demo/config/webpacker.yml (RuntimeError)

and when I install webpack with "bundle exec rails webpacker:install", I get this:

Webpacker requires Yarn ">=1 <3" and you are using 0.32+git Please upgrade Yarn https://yarnpkg.com/lang/en/docs/install/ Exiting!

and then : "npm install --global yarn"

I get this :

> yarn@1.22.10 preinstall /home/hossein/.npm-global/lib/node_modules/yarn
> :; (node ./preinstall.js > /dev/null 2>&1 || true)

/home/hossein/.npm-global/bin/yarn -> /home/hossein/.npm-global/lib/node_modules/yarn/bin/yarn.js /home/hossein/.npm-global/bin/yarnpkg -> /home/hossein/.npm-global/lib/node_modules/yarn/bin/yarn.js

  • yarn@1.22.10 updated 1 package in 2.123s

2 Answers2

1

Try this:

  1. sudo npm install -g npm
  2. sudo npm install -g yarn
mikgn
  • 15
  • 1
  • 6
1

This article pointed me in the right direction.. but my fix was a bit more involved. After these steps, closing the shell and restarting the system worked for me. Upgrade credit to this answer

NOTE that verifying the npm version didn't work until I restarted everything.

Enable the nodesource repo:

curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -

Install Node.js and npm:

sudo apt install nodejs

Verify it works:

node --version
npm --version

Upgrade yarn:

curl --compressed -o- -L https://yarnpkg.com/install.sh | bash
Dharman
  • 30,962
  • 25
  • 85
  • 135