Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webpacker gem no longer provides yarn binstub #716

Closed
1 of 4 tasks
asaletnik opened this issue May 16, 2017 · 0 comments
Closed
1 of 4 tasks

Webpacker gem no longer provides yarn binstub #716

asaletnik opened this issue May 16, 2017 · 0 comments

Comments

@asaletnik
Copy link
Contributor

Help us help you! Please choose one:

  • My app crashes with react-rails, so I've included the stack trace and the exact steps which make it crash.
  • My app doesn't crash, but I'm getting unexpected behavior. So, I've described the unexpected behavior and suggested a new behavior.
  • I'm trying to use react-rails with another library, but I'm having trouble. I've described my JavaScript management setup (eg, Sprockets, Webpack...), how I'm trying to use this other library, and why it's not working.
  • I have another issue to discuss.

I have just installed fresh versions of webpacker and react-rails gems today - running on Rails 4.2.8.

I followed the installation guide, and noticed that it throws some warning, but without failing:

rails generate react:install
       exist  app/javascript/components
   identical  app/javascript/components/.gitkeep
bin/rails: No such file or directory - /home/asaletnik/Apps/example-app/bin/yarn
      append  app/javascript/packs/application.js
   identical  app/javascript/packs/server_rendering.js

Ignored it at first, but quickly found out that it leads to webpack compile error, as without yarn the react_ujs module is missing:

ERROR in ./app/javascript/packs/application.js
Module not found: Error: Can't resolve 'react_ujs' in '/home/asaletnik/Apps/example-app/app/javascript/packs'
 @ ./app/javascript/packs/application.js 3:20-40
 @ multi (webpack)-dev-server/client?http://localhost:5001 ./app/javascript/packs/application.js

ERROR in ./app/javascript/packs/server_rendering.js
Module not found: Error: Can't resolve 'react_ujs' in '/home/asaletnik/Apps/example-app/app/javascript/packs'
 @ ./app/javascript/packs/server_rendering.js 4:20-40
 @ multi (webpack)-dev-server/client?http://localhost:5001 ./app/javascript/packs/server_rendering.js
webpack: Failed to compile.

This is related to a webpacker pull request merged just 4 days ago - rails/webpacker#367
For some reason they don't provide yarn binstub any more, instead they now call the executable directly.

The yarn binstub is still present in the Rails 5.1-stable:
https://github.com/rails/rails/blob/5-1-stable/railties/lib/rails/generators/rails/app/templates/bin/yarn

I have made a fork of react-rails and updated install_generator#setup_react_webpacker to use yarn executable directly as well - will add a Pull Request shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant