When i am creating new rails application i am getting error with webpacker (ArgumentError: Malformed version number string 0.32+git)
To include Webpacker in a new project, add --webpack to the rails new command. To add Webpacker to an existing project, add the webpacker gem to the project's Gemfile , run bundle install , and then run bin/rails webpacker:install . The installation also calls the yarn package manager, creates a package.
I was running into a similar issue running rails 6 on my Docker container. Turns out Rails 6 uses Webpacker
, which needs yarn to be installed. Follow steps to install a newer version of Yarn
For Debian make sure these steps are followed
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
and then
sudo apt update && sudo apt install yarn
This gave me yarn --version
-> 1.19.1
after which sample rails new blog
ran successfully, and added blog/config/webpacker.yml
(Related to Vanilla Rails 6.0: "error Command "webpack" not found")
It is strange that the documentation does not mention yarn
as a dependency.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With