React-rails server rendering packs
See original GitHub issueHelp us help you! Have you looked for similar issues? Do you have reproduction steps? Contributing Guide
Steps to reproduce
(Guidelines for creating a bug report are available here)
Expected behavior
Server rendering in production should work the same as in development
Actual behavior
Server rendering in production is not the same.
System configuration
Sprockets or Webpacker version: 4.0 React-Rails version: “~> 2.3.1” React_UJS version: “^2.5.0” Rails version: “~> 5.2.0” Ruby version: “2.6.3”
Hey there!
I’m having this issue for a couple of days now and don’t know how to fix it.
I’m getting the following error on production:
No such file or directory @ rb_sysopen - public/js/server_rendering-7930ba59728fe68ecc97.js
This error is correct since no .js
file is present with that name.
The actual path name is:
packs/js/server_rendering-7930ba59728fe68ecc97.js
Any idea where this problem is coming from? This code works perfectly in development but it seems wrong paths get assigned when deploying.
Any help in the right direction would be extremely helpful.
Kind regards Jens
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (1 by maintainers)
Top GitHub Comments
Note: I believe this is a different issue than the original post, but I’m posting here in case google sent you to this same page. TL;DR: use the edge version of react-rails until they cut a new release or monkey patch it.
I had a similar issue after upgrading from ruby 2.7.2 to 3.0.3. Unlike with naft-a, it works just fine without
./bin/webpack-dev-server
running, but fails when it is running, and thus my error isNo such file or directory @ rb_sysopen - http://localhost:3035/packs/js/server_rendering-a5bfcb3dc949a5ce125a.js
. I can also verify that the javascript is building properly, as going tohttp://localhost:3035/packs/js/server_rendering-a5bfcb3dc949a5ce125a.js
does have the right javascript. Indeed, the root cause of this is in ruby 3open-uri
no longer overwritingKernel.open
(see here for more details). react-rails hadn’t updated webpacker_manifest_container.rb to callURI.open
instead of justopen
until this commit.Here’s the kicker: that commit, which fixes things, was on 2021-01-02, whereas as of the time of this post the latest version of react-rails on rubygems.org is 2.6.1, released on 2019-12-31. As such, there are three options for how to fix this:
gem 'react-rails', git: 'https://github.com/reactjs/react-rails'
in your gemfile. This is a bit risky, as it could add instability as they do developmentURI.open
. Personally I’d avoid this, as you have to do this on every machine you do dev on.I confirm that this is the problem