Ever-present RoutingErrors for javascript/workbox/ files in Rails 5 + React app

126 views Asked by At

Specs: Rails 5.2, Ruby 2.5.1, Yarn 1.91.1, React-Rails 2.6.0, Postgresql 10, Ubuntu 18.04

Issue: Getting these ever present error messages in my logs after I set up a rails app with react. The errors are all looking for routes for javascript/workbox/ files once I start the server with rails s

Started GET "/service-worker.js" for 127.0.0.1 at 2019-11-14 09:28:15 -0700
Started GET "/javascripts/workbox/workbox-sw.js" for 127.0.0.1 at 2019-11-14 09:28:15 -0700
Started GET "/javascripts/workbox/workbox-expiration.prod.js" for 127.0.0.1 at 2019-11-14 09:28:15 -0700
Started GET "/javascripts/workbox/workbox-core.prod.js" for 127.0.0.1 at 2019-11-14 09:28:15 -0700
Started GET "/javascripts/workbox/workbox-strategies.prod.js" for 127.0.0.1 at 2019-11-14 09:28:15 -0700
ActionController::RoutingError (No route matches [GET] "/service-worker.js"):

Notice the errors begin on the last line and will continue from there for each of those GET requests.

What I did: I followed instructions from multiple sources (Here's 1 and another) telling me to do basically the same thing. I ran rails new app --database=postgresql --webpack=react which runs normally. Then I add the gem react-rails to my gemfile and bundle install again. I next run rails generate react:install and everything seems fine except for a few warnings. Here are some of the warnings, I don't know if these are causing the issue or not.

warning " > @babel/[email protected]" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@babel/preset-react > @babel/[email protected]" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@babel/preset-react > @babel/[email protected]" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@babel/preset-react > @babel/[email protected]" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@babel/preset-react > @babel/[email protected]" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@babel/preset-react > @babel/plugin-transform-react-jsx > @babel/[email protected]" has unmet peer dependency "@babel/core@^7.0.0-0".
warning " > [email protected]" has unmet peer dependency "webpack@^4.0.0". warning "webpack-dev-server > [email protected]" has unmet peer dependency "webpack@^4.0.0".

Not sure if those warnings matter or if there is another reason that my app isn't setting up Workbox properly.

React itself is working. The default Hello world rails app works fine. It is just the constant failed GET requests to Workbox files that is causing me grieve.

0

There are 0 answers