Skip to content

Should "rails new --webpack=..." stop when bin/yarn fails? #103

@marcusmolchany

Description

@marcusmolchany

Locally I was running node version 5.0.0 which caused an error during the yarn install step of rails new.

loader-runner (a sub-dependency of webpack) failed because of its engines requirement in package.json. This prevented ./bin/webpack-watcher from running because it was not installed in the node_modules folder.

My question is should the rails new --wepback=... command fail if there is an issue during the yarn install? After rails new ran and completed, with errors further up in the logs, it took some time to trace back why ./bin/webpacker-watcher was not running.


Below is the full output of my rails new commands (omitted large output for brevity using [...]). The current working directory of the command is the root directory of cloning rails/rails from github. The error occurs in the logs after run ./bin/yarn add --dev webpack webpack-merge webpack-dev-server path-complete-extname babel-loader babel-core babel-preset-latest coffee-loader coffee-script rails-erb-loader glob from "."

$ ./rails/railties/exe/rails new my5oneapp --edge --webpack=react
      create  
      create  README.md
      create  Rakefile
      [...]
      create  vendor/.keep
      create  package.json
      remove  config/initializers/cors.rb
         run  bundle install
Fetching https://github.com/rails/rails.git
[...]
Fetching dependency metadata from https://rubygems.org/.
Resolving dependencies...
Using rake 12.0.0
Using concurrent-ruby 1.0.4
[...]
Using webpacker 0.2 from https://github.com/rails/webpacker.git (at master@35586c7)
Using rails 5.1.0.alpha from https://github.com/rails/rails.git (at master@ecca24e)
Using sass-rails 6.0.0.beta1 from https://github.com/rails/sass-rails.git (at master@dfbcc6a)
Bundle complete! 17 Gemfile dependencies, 70 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
       rails  webpacker:install
      create  app/javascript
      create  app/javascript/packs/application.js
       exist  bin
      create  bin/webpack-dev-server
      create  bin/webpack-watcher
      create  bin/webpack
    conflict  bin/yarn
Overwrite /Users/mmolchany/development/my5oneapp/bin/yarn? (enter "h" for help) [Ynaqdh] 
       force  bin/yarn
      create  config/webpack
      create  config/webpack/development.js
      create  config/webpack/production.js
      create  config/webpack/shared.js
      append  .gitignore
         run  ./bin/yarn add --dev webpack webpack-merge webpack-dev-server path-complete-extname babel-loader babel-core babel-preset-latest coffee-loader coffee-script rails-erb-loader glob from "."
yarn add v0.19.1
info No lockfile found.
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
error loader-runner@2.3.0: The engine "node" is incompatible with this module. Expected version ">=4.3.0 <5.0.0 || >=5.10".
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
       rails  webpacker:install:react
Replacing loader presets to include react in /Users/mmolchany/development/my5oneapp/config/webpack/shared.js
Replacing loader test to include react in /Users/mmolchany/development/my5oneapp/config/webpack/shared.js
Copying react example to app/javascript/packs/hello_react.js
yarn add v0.19.1
info No lockfile found.
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 📃  Building fresh packages...
success Saved lockfile.
success Saved 17 new dependencies.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions