Reputation: 4897
I am following a simple tutorial on how to use MongoDB with rails. It is a traditionally simple blog app where you have all CRUD actions. The tutorial can be found here.
I am trying to set up a fresh Rails 6 application but am running into a series of problems with web packer. To begin with, when I try to access localhost:3000/posts
, I receive the following error:
Webpacker::Manifest::MissingEntryError in Posts#index
The error has the following recomendations
1. You want to set webpacker.yml value of compile to true for your environment
unless you are using the `webpack -w` or the webpack-dev-server.
2. webpack has not yet re-run to reflect updates.
3. You have misconfigured Webpacker's config/webpacker.yml file.
4. Your webpack configuration is not creating a manifest.
Your manifest contains:
{
}
I currently do not have a manifest.json
file. When I try to run bundle exec rake webpacker:compile
, I get the following error:
Compilation failed:
[webpack-cli] Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.node should be one of these:
false | object { __dirname?, __filename?, global? }
-> Include polyfills or mocks for various node stuff.
Details:
* configuration.node has an unknown property 'dgram'. These properties are valid:
object { __dirname?, __filename?, global? }
-> Options object for node compatibility features.
* configuration.node has an unknown property 'fs'. These properties are valid:
object { __dirname?, __filename?, global? }
-> Options object for node compatibility features.
* configuration.node has an unknown property 'net'. These properties are valid:
object { __dirname?, __filename?, global? }
-> Options object for node compatibility features.
* configuration.node has an unknown property 'tls'. These properties are valid:
object { __dirname?, __filename?, global? }
-> Options object for node compatibility features.
* configuration.node has an unknown property 'child_process'. These properties are valid:
object { __dirname?, __filename?, global? }
-> Options object for node compatibility features.
From these errors and reading some stack overflow questions, I am having a very difficult time getting this simple application to load and I'm not sure how to attack the problem.
For starters, I have the latest node installed which is node v14.15.0
. Secondly, I should have all the dependencies needed to run the js portion of the app. Here is my package.json
.
{
"name": "blog",
"private": true,
"dependencies": {
"@rails/actioncable": "^6.0.0",
"@rails/ujs": "^6.0.0",
"@rails/webpacker": "4.3.0",
"turbolinks": "^5.2.0",
"webpack": "^5.4.0",
"webpack-cli": "^4.2.0"
},
"version": "0.1.0",
"devDependencies": {
"webpack-dev-server": "^3.11.0"
}
}
I am not sure how to go about fixing this problem. I've already done what some stack overflow questions have suggested. I have reinstalled yarn, updated node, etc. I could really use some help as to how to get past this issue. Thank you.
Upvotes: 1
Views: 1260
Reputation: 1
You can remove the existing webpack and try these steps.
yarn add webpack@4
yarn add webpack-cli
yarn add @rails/webpacker
yarn add bootstrap@next jquery @popperjs/core
Check if the webpack is compiling well
bin/rails webpacker:compile
Upvotes: 0
Reputation: 11
I made the same mistake, but maybe the webpacker and Manifest, which aren't compatible with the latest version, interfered because I put in the latest version of webpack / webpack cli myself? This is a package.json I started with Rails6 + vue.js but I don't have webpack / webpack cli installed. You can still start it.
package.json
{
"name": "app_name",
"private": true,
"dependencies": {
"@rails/actioncable": "^6.0.0",
"@rails/activestorage": "^6.0.0",
"@rails/ujs": "^6.0.0",
"@rails/webpacker": "4.3.0",
"axios": "^0.21.0",
"postcss-selector-parser": "^6.0.4",
"turbolinks": "^5.2.0",
"vue": "^2.6.12",
"vue-loader": "^15.9.5",
"vue-router": "^3.4.9",
"vue-template-compiler": "^2.6.12"
},
"version": "0.1.0",
"devDependencies": {
"tailwindcss-multi-column": "^1.0.2",
"webpack-dev-server": "^3.11.0"
}
}
Upvotes: 1