When i am creating new rails application i am getting error with webpacker (ArgumentError: Malformed version number string 0.32+git)
-
1Hi, can you paste in the complete command you type when creating the application? – Amin Shah Gilani Aug 25 '19 at 02:48
-
rails new "app_name" -d mysql, my rails version is 6.0.0 – Hijas ajmal Aug 25 '19 at 06:47
7 Answers
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.

- 3,885
- 1
- 33
- 44
I confronted the same issue and resolved by installing yarn using nvm.
npm install -g yarn
After installing and updating yarn to the current version, I have my Webpacker successfully installed.

- 31
- 1
I installed yarn by running sudo apt-get installed yarn
on my POP OS(Ubuntu under the hood), and get the same error as yours.
Then, I have fixed this error by following the steps at yarn official page, https://classic.yarnpkg.com/en/docs/install/#debian-stable
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
Then,
sudo apt-get update
Finally,
sudo apt-get install yarn

- 345
- 1
- 5
- 15
I should say this error was a step two error, I first had this other highly related problem Vanilla Rails 6.0: "error Command "webpack" not found" and then I was led here.
Here is what I did to solve it. +32 was indeed coming from yarn
$ yarn --version
0.32+git
I tried to find the lucky combination of node/npm/yarn/webpack but I never won anything at the lottery
so I removed yarn...
- open your
package.json
in your favorite editor - make sure
yarn
is NOT there - delete yarn, or rename the binary
rails webpacker:install
# now happyrake assets:precompile
# also happyrails s
# works fine again, I can use ActionCable finally.

- 1,932
- 19
- 29
If you put 0.32+git as version number please try using a numeric version number, eg: 0.32 (drop the +git)

- 104
- 5
Try to update your Yarn version. Webpacker uses Yarn and it probably won't work with an old version, such as "0.32+git". When I updated my version, the problem got solved and I could run the rails application.