Webpacker: bundle exec rails webpacker:install fails on ruby 2.5

Created on 26 Feb 2018  ยท  11Comments  ยท  Source: rails/webpacker

$ ruby -v # => ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]
$ rails -v # => Rails 5.1.5
$ rails new myapp --webpack=react
...
Bundle complete! 17 Gemfile dependencies, 72 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
       rails  webpacker:install
Traceback (most recent call last):
/home/wasd/.rubies/ruby-2.5.0/bin/ruby: invalid option -2  (-h will show valid options) (RuntimeError)
       rails  webpacker:install:react
Configuration config/webpacker.yml file not found. 
Make sure webpacker:install is run successfully before running dependent tasks
         run  bundle exec spring binstub --all
* bin/rake: spring inserted
* bin/rails: spring inserted
$ ruby -v  # => ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]
$ rails -v # => Rails 5.1.5
$ rails new myapp --webpack=react
...
Bundle complete! 17 Gemfile dependencies, 72 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
       rails  webpacker:install
      create  config/webpacker.yml
Copying webpack core config
      create  config/webpack
      create  config/webpack/development.js
      create  config/webpack/environment.js
      create  config/webpack/production.js
      create  config/webpack/test.js
Copying .postcssrc.yml to app root directory
      create  .postcssrc.yml
Copying .babelrc to app root directory
      create  .babelrc
Creating JavaScript app source directory
      create  app/javascript
      create  app/javascript/packs/application.js
Installing binstubs
         run  bundle binstubs webpacker from "."
Adding configurations
      append  .gitignore
Installing all JavaScript dependencies
         run  yarn add @rails/webpacker from "."
yarn add v1.3.2
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "@rails/webpacker > [email protected]" has unmet peer dependency "caniuse-lite@^1.0.30000697".
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 621 new dependencies.
...
Done in 8.61s.
Installing dev server for live reloading
         run  yarn add --dev webpack-dev-server from "."
yarn add v1.3.2
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
error [email protected]: The engine "node" is incompatible with this module. Expected version ">=6.11.5".
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Webpacker successfully installed ๐ŸŽ‰ ๐Ÿฐ
       rails  webpacker:install:react
Webpacker is installed ๐ŸŽ‰ ๐Ÿฐ
Using /home/wasd/Programs/webpacker-ts-issue/config/webpacker.yml file for setting up webpack paths
Copying react preset to your .babelrc file
Copying react example entry file to /home/wasd/Programs/webpacker-ts-issue/app/javascript/packs
      create  app/javascript/packs/hello_react.jsx
Updating webpack paths to include .jsx file extension
      insert  config/webpacker.yml
Installing all react dependencies
         run  yarn add react react-dom babel-preset-react prop-types from "."
yarn add v1.3.2
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "@rails/webpacker > [email protected]" has unmet peer dependency "caniuse-lite@^1.0.30000697".
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 22 new dependencies.
...
Done in 3.43s.
Webpacker now supports react.js ๐ŸŽ‰
         run  bundle exec spring binstub --all
* bin/rake: spring inserted
* bin/rails: spring inserted

Most helpful comment

@007lva That fixed the problem, thanks!

Just to clarify, there's a reason I didn't expect this to be a problem. In the second block that complains about "node", that's a successful webpack installation on 2.4 with an old verison of node.

However, in the first block, it never lists node as a problem.

Is this worth a mention that this repo requires node 8.x.x or higher? (not 6 as, mentioned in README).

All 11 comments

weird, i just ran it on macOSX 10.13.3, ruby 2.5.0p0 with rails new app --webpack=react. And It works for me.

@ytbryan What version of rails are you using? Can you try with 5.1.5?

Yup

Not sure, only thing I can think is I'm on Ubuntu and you're on OS X. It works fine for me on 5.1.4.

I tried to replicate this on digital ocean with clean box. I was not able to do so. Closing this issue. Not sure what's up with my machine.

It's happening the same on a fresh instance on AWS EC2

thanks for chiming in @kriera. how did you install ruby 2.5.0? i tried using ruby-install and chruby.

upgraded the system installing ruby 2.5.0 and using it default, chowned the dir from root (you only can install doing su) to ec2-user, and then again same issues, it seems be related to the gem rb-inotify

"Installing dev server for live reloading
run yarn add --dev webpack-dev-server from "."
yarn add v1.5.1
[1/4] Resolving packages...
โ „ webpack-dev-serverE, [2018-02-28T18:04:13.836915 #5193] ERROR -- : run() in thread failed: inotify event queue has overflowed.:n /usr/local/rvm/gems/ruby-2.5.0/gems/rb-inotify-0.9.10/lib/rb-inotify/event.rb:120:in `initialize'"

here is a partial log, some one points to this fork as the solution https://github.com/e2/rb-inotify that's all the info i've atm. thanks

From your logs:

error [email protected]: The engine "node" is incompatible with this module. Expected version ">=6.11.5".
error Found incompatible module

Maybe you should try with Node 8.x.

@007lva That fixed the problem, thanks!

Just to clarify, there's a reason I didn't expect this to be a problem. In the second block that complains about "node", that's a successful webpack installation on 2.4 with an old verison of node.

However, in the first block, it never lists node as a problem.

Is this worth a mention that this repo requires node 8.x.x or higher? (not 6 as, mentioned in README).

@sunnyrjuneja Webpacker doesn't support dev server 3.x yet - https://github.com/webpack/webpack-dev-server/blob/master/package.json#L18

error [email protected]: The engine "node" is incompatible with this module. Expected version ">=6.11.5".
error Found incompatible module

We will bump the node versions once Webpacker is upgraded to use webpack v4+

Was this page helpful?
0 / 5 - 0 ratings

Related issues

naps62 picture naps62  ยท  3Comments

towry picture towry  ยท  3Comments

Eearslya picture Eearslya  ยท  3Comments

itay-grudev picture itay-grudev  ยท  3Comments

swrobel picture swrobel  ยท  3Comments