Hi guys, I'm having weird error after server start. Error disappears when I change url in my browser or after few page reloads. Here's what I'm getting:
Sprockets::FileNotFound in Home#index
Showing /home/funky/projects/billbill/app/views/layouts/application.html.erb where line #7 raised:
couldn't find file 'webpack-bundle' with type 'application/javascript'
Checked in these paths:
/home/funky/projects/billbill/app/assets/config
/home/funky/projects/billbill/app/assets/images
/home/funky/projects/billbill/app/assets/javascripts
/home/funky/projects/billbill/app/assets/stylesheets
/home/funky/projects/billbill/app/assets/webpack
/home/funky/projects/billbill/vendor/assets/javascripts
/home/funky/projects/billbill/vendor/assets/stylesheets
/home/funky/.gem/ruby/2.3.1/gems/jquery-rails-4.2.1/vendor/assets/javascripts
/home/funky/.gem/ruby/2.3.1/gems/coffee-rails-4.2.1/lib/assets/javascripts
/home/funky/.gem/ruby/2.3.1/gems/actioncable-5.0.0.1/lib/assets/compiled
/home/funky/.gem/ruby/2.3.1/gems/turbolinks-source-5.0.0/lib/assets/javascripts
/home/funky/projects/billbill/app/assets/webpack
/home/funky/.gem/ruby/2.3.1/gems/bootstrap-sass-3.3.7/assets/stylesheets
/home/funky/.gem/ruby/2.3.1/gems/bootstrap-sass-3.3.7/assets/javascripts
/home/funky/.gem/ruby/2.3.1/gems/bootstrap-sass-3.3.7/assets/fonts
/home/funky/.gem/ruby/2.3.1/gems/bootstrap-sass-3.3.7/assets/images
Is it something wrong with my environment? You may check my repo, I'm getting it in blank project, after installing react on rails, so after this commit.
I was following this tutorial using chruby+ruby-install instead of rvm and rails 5 instead of 4. And I'm using Atom, not RubyMine.
Maybe it's OK? Maybe It's just needs some time on my laptop...
P.S. error log is from the latest commit.
You need to make sure that your webpack config files and the your initializers/react_on_rails.rb files point to the same output files. Apparently, you have webpack-bundle in your initializer, but not in your webpack config files.
@justin808 OK, I already have them in webpack config here:
https://github.com/FunkyloverOne/billbill/blob/master/client/webpack.config.js#L16
But I do not see where I should put inside initializer, looks like it's already there too...
https://github.com/FunkyloverOne/billbill/blob/master/config/initializers/react_on_rails.rb#L10
BTW, I haven't changed any configs, so that's what was set by your generator.
I'm pretty sure the default generator works. I just created a few videos on this:
@FunkyloverOne Do you think there's an issue with React on Rails, or your own setup?
Yup, it all works, just as I tought - my system is just a bit slow.
Thanks for your videos, they makes me feel not that scared of all that new stuff :D
The webpack-bundle.js file is just being deleted after server starts and in takes some time to regenerate it.
I'll just leave this here for anyone else who ran into this while trying to Dockerize a Rails application using react_on_rails: https://blog.codeship.com/using-honcho-create-multi-process-docker-container/.
I ran into this issue because the Docker container couldn't run multiple Foreman processes, even when using the "formation" options to run them concurrently. Installing and using Honcho instead of Foreman solved it for me.
This issue is coming for me too from a fresh install
@icemelt7 any ideas?
This is happening for me on heroku. My app was working fine, then all of a sudden Heroku fails the asset-pipeline because:
Sprockets::FileNotFound: couldn't find file 'webpack-bundle' with type 'application/javascript'
To be clear, even if I rollback to an earlier commit -- that previously worked fine on heroku, it's still failing. Hmm...
doh ...looks like running assets locally and committing my public/assets/ folder resolved this issue for me.
And, forgive me for not saying so before: thanks for this incredible project!
@JayTeeSF You should not be committing to your /public/assets folder.
PS. Please tweet to hash tag #react_on_rails and/or comment on https://github.com/shakacode/react_on_rails/blob/master/KUDOS.md with gratitude.
I really appreciate it. 馃檹馃槆馃憤.
In case anyone else runs in to this, I was using puma, not foreman. When using puma you must separately run webpack using a command like:
sh -c 'rm app/assets/webpack/* || true && cd client &&
bundle exec rake react_on_rails:locale && yarn run build:development'
either in a separate window or in the script that starts puma.
In that case, you can remove /Procfile.dev, which supports foreman.
@mustmodify hey dude did you already try your solution in production? How does it work
@giovapanasiti The above solution is only needed for dev. In production, capistrano runs rake assets:precompile which (I guess) triggers webpack to run the once time. Here's what I did to set up my production machine: https://gist.github.com/mustmodify/e4d29b6dd9992381b66cd4efe0b6d32c
@giovapanasiti yep, it hooks into assets:precompile
Most helpful comment
@giovapanasiti yep, it hooks into assets:precompile