On a brand new rails 6.1.7.4
app, I'm getting the following error when making a request to any page besides the default "Rails::WelcomeController#index" screen:
Webpacker::Manifest::MissingEntryError in Blogs#Index
Reproduction steps:
rails new rails_6-1_app
cd rails_6-1_app
rails g scaffold blog title
rails db:migrate
rails s
# Make request to http://localhost:3000/blogs/
Environment:
- Ruby 2.7.4p191
- Rails 6.1.7.4
- node 16.20.2 (but node versions 18 and 20 were attempted as well)
- yarn 1.22.19
- macOS Ventura 13.5
Webpacker:compile error
I notice that when I attempt rails webpacker:compile
I get more information on what is going on:
Compiling...
Compilation failed:
node:internal/process/promises:279
triggerUncaughtException(err, true /* fromPromise */);
^
Error: Cannot find package '@babel/plugin-proposal-private-methods' imported from /<Path-TO-MY-APP>/rails_6-1_app/babel-virtual-resolve-base.js
It was suggested via this rails issue to modify two lines within the default, generated babel.config.js file:
// babel.config.js
// replace this line
// '@babel/plugin-proposal-private-methods',
// with this line
'@babel/plugin-transform-private-methods',
// also replace this line
// '@babel/plugin-proposal-private-property-in-object',
// with this line
'@babel/plugin-transform-private-property-in-object',
However, making that change and then running rails webpacker:compile
generates a new error:
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:69:19)
at Object.createHash (node:crypto:133:10)
at module.exports (/<Path-To-My-App>/rails_6-1_app/node_modules/webpack/lib/util/createHash.js:135:53)