-
Notifications
You must be signed in to change notification settings - Fork 752
Description
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.