The error message

After I installed Ruby on Rails 6.0 yesterday and happily initialized the project and followed the instructions to install Webpacker, I ran the familiar Rails C command and got an error:

Yarn Check v1.7.0 success Folder in sync. Done in 0.15s. yarn check v1.7.0 error "webpack-dev-server#yargs#cliui" is wrong version: Expected "^4.0.0", got "5.0.0" error "webpack-dev-server#yargs#yargs-parser" is wrong version: Expected "^ 11.1.1", Got "13.1.1" error Found 2 errors. The info Visit https://yarnpkg.com/en/docs/cli/check for documentation about this command.

The solution

There isn’t much available about Rails 6.0 right now, but I found a Japanese post that addressed the above problem:

$ brew upgrade yarn
$ yarn upgrade

Finally the problem is solved and we can move forward happily again!

Note: I haven’t done much Rails projects myself for over a year, and full-stack development has been even longer. Rails 6.0 changes a lot, and I haven’t had time to familiarize myself with many of the new components, so I won’t do the rationale for the above solution in this article, just as a reminder that someone else may have the same problem.

The resources

  • When Rails6 is open につまづきそうな Webpacker, Yarn kankanen solution