React/Rails app: webpack Webpacker::Manifest::MissingEntryError - node.js

I have looked through and tried all of the existing solutions on Stack Overflow. I have:
changed my node version
installed rails:webpacker over and over
deleted node_modules and public/packs folder
ran yarn install, bundle
but I keep getting this error:
Webpacker::Manifest::MissingEntryError
Webpacker can't find hello_react in .../public/packs/manifest.json. Possible causes:
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:
{
}
The line giving an error:
<%= javascript_pack_tag 'hello_react' %>
My versions:
node: v16.14.2
Rails 6.0.6
my package.json:
{
"name": "appname",
"private": true,
"dependencies": {
"#babel/preset-react": "^7.18.6",
"#rails/actioncable": "^6.0.0",
"#rails/activestorage": "^6.0.0",
"#rails/ujs": "^6.0.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"turbolinks": "^5.2.0",
"webpack": "4.46.0"
},
"version": "0.1.0",
"devDependencies": {
"webpack-cli": "^4.10.0",
"webpack-dev-server": "^4.11.1"
}
}
I cannot move past this error, what am I missing?

Related

Why aws app runner looks trying to build packages on node 12 even if node 14 is selected?

I'm trying to generate a build of our Next.js application that is on a Github repository. We used node 14.19.3 to build the application, and it runs fine on local development.
The package.json of main project is
{
"name": "example-name",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"#apollo/client": "^3.6.4",
"graphql": "^16.5.0",
"#our-private-package": "^1.0.7",
"framer-motion": "^2.9.4",
"i18next": "^21.8.0",
"js-cookie": "^2.2.1",
"next": "^12.1.6",
"next-cookies": "^2.0.3",
"ni18n": "^1.0.3",
"prop-types": "^15.7.2",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"react-ga": "^3.3.0",
"react-i18next": "^11.16.9",
"react-icons": "^4.3.1",
"react-modal": "^3.11.2",
"react-redux": "^7.2.1",
"react-slick": "^0.27.11",
"react-slider": "^2.0.1",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0",
"sass": "^1.26.11",
"slick-carousel": "^1.8.1"
},
"devDependencies": {
"#ermeschultz/chai-arrays": "^2.3.0",
"chai": "^4.2.0",
"eslint": "^7.2.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.20.6",
"eslint-plugin-react-hooks": "^4.0.0",
"esm": "^3.2.25",
"file-loader": "^6.1.0",
"mocha": "^8.1.3",
"prettier": "^2.1.1",
"redux-devtools-extension": "^2.13.8",
"redux-logger": "^3.0.6",
"url-loader": "^4.1.0"
}
}
Our private package have this package.json file:
{
"name": "#our-private-package",
"version": "1.0.7",
...
"engines": {
"yarn": ">=1.22.0",
"npm": ">=6.14.16",
"node": ">=14"
},
"scripts": {
"prepare": "npm run build",
"start": "node ./build/index.js",
"dev": "ts-node ./src/index.ts",
"build": "tsc --module commonjs"
},
"dependencies": {
"canvas": "^2.9.1",
"canvas-5-polyfill": "^0.1.5"
},
"devDependencies": {
"#types/node": "^17.0.33",
"#types/react": "^17.0.39",
"#types/react-dom": "^17.0.3",
"react": "^17.0.0",
"react-dom": "^17.0.0",
"ts-node": "^10.7.0",
"typescript": "^4.6.4"
},
"peerDependencies": {
"react": "^17.0.0",
"react-dom": "^17.0.0"
}
}
To create the service, I selected nodejs 14 platform and put these build commands in the app runner user interface:
export VARIABLE=value; npm install; npm run build
*The variable is an env variable necessary to import some private packages.
And this running commands in the app runner user interface:
npm start
The build logs show the message:
"[Build] \u001b[0m\u001b[91mError: The module '/app/node_modules/canvas/build/Release/canvas.node'\n",
"[Build] was compiled against a different Node.js version using\n",
"[Build] NODE_MODULE_VERSION 72. This version of Node.js requires\n",
"[Build] NODE_MODULE_VERSION 83. Please try re-compiling or re-installing\n",
I removed the private package and then project builds successfully on app runner. But I just can't reproduce the same problem on my local machine.
The error on message was reported previously on Stack Overflow, always relating to the use of another version of node than the current used one. It is always solved by reinstalling, rebuilding, and/or clearing the npm cache. But app runner creates the container from scratch.
The interface shows that we are using Node js 14 environment. But it seems running on the Node js 12 platform when running npm run build command. At least for the canvas module build.
It could be a package conflict case. But, why this shows the message like it was build in node 12? Why the same problem does not happens in my local development even if I'm using same node and npm present in App Runner?
It is not a definitive complete answer to the question, but run yarn install; yarn build instead npm make the same code runs on app runner.

POSTCSS - NPM Error Running NPM RUN PRODUCTION

I'm getting the following error anytime I try to run 'npm run production'. The rest of the error is just a list of 'node_modules' packages where this error also occur.
ERROR in ./resources/assets/sass/app.scss
Module build failed: ModuleBuildError: Module build failed: TypeError: Cannot read property 'unprefixed' of undefined at clearDecl (/Users/prusso/Sites/qut-match-my-skills/node_modules/postcss-unprefix/lib/clearDecl.js:13:30)
I believe the error is in the version of 'autoprefixer' and/or 'postcss-unprefix'. Please check my 'devDependencies' below:
"devDependencies": {
"autoprefixer": "^8.6.3",
"babel-eslint": "^8.2.6",
"babel-polyfill": "^6.26.0",
"browser-sync": "^2.24.5",
"browser-sync-webpack-plugin": "2.0.1",
"cross-env": "^5.2.0",
"cssnano": "^3.10.0",
"eslint": "^4.0.0",
"eslint-plugin-vue": "^4.7.1",
"laravel-mix": "^2.1.11",
"postcss-unprefix": "^2.1.3",
"prettier-eslint": "^8.8.2",
"raw-loader": "^0.5.1"
},
"dependencies": {
"#nextindex/next-scss": "^1.2.1",
"animate-sass": "^0.8.2",
"axios": "^0.18.0",
"babel-core": "^6.26.3",
"es6-promise": "^4.2.4",
"family.scss": "^1.0.8",
"lodash.compact": "^3.0.1",
"lodash.get": "^4.4.2",
"normalize.css": "^8.0.0",
"portal-vue": "^1.3.0",
"smoothscroll-polyfill": "^0.4.3",
"uuid": "^3.3.2",
"vue": "^2.5.16",
"vue-parallaxy": "^1.1.1",
"vue-router": "^3.0.1",
"vuex": "^3.0.1",
"vuex-persistedstate": "^2.5.4",
"zeus-grid": "^8.2.0"
}
Other thing that I have noticed is that if I comment out the following line 'require('postcss-unprefix')' inside 'webpack.mix.js' and run 'npm run production' everything works fine.
mix.options({
postCss: [
// require('postcss-unprefix'),
require('autoprefixer')({
browsers: '>0.1%',
}),
require('cssnano')({
preset: [
'default',
{
discardComments: {
removeAll: true,
},
},
],
}),
],
});
Thanks for your help!!
try autoprefixer:10.2.5 latest version
Trt postcss-rtlcss package insted of postcss-rtl
Latest version (postcss#^8.0.0)
npm install postcss-rtlcss --save-dev
Latest legacy version (postcss#^7.0.0)
npm install postcss-rtlcss#legacy --save-dev

When I try to use Parcel to build a production version of a React app that works fine in development mode, I get "Cannot find module 'sass'"

I've built a simple React/Redux app and am using Parcel for the bundler. It works fine in development mode, that is, using the script
"dev": "parcel ./src/index.html",
but when I tried to do
"build": "parcel build ./src/index.html",
I got the following error
/Users/abc/Documents/Projects/sandbox/smart/src/styles/main.scss: Cannot find module 'sass' from '/Users/abc/Documents/Projects/sandbox/smart/src/styles'
at /Users/abc/Documents/Projects/sandbox/smart/node_modules/resolve/lib/async.js:97:35
at processDirs (/Users/abc/Documents/Projects/sandbox/smart/node_modules/resolve/lib/async.js:244:39)
at isdir (/Users/abc/Documents/Projects/sandbox/smart/node_modules/resolve/lib/async.js:251:32)
at /Users/abc/Documents/Projects/sandbox/smart/node_modules/resolve/lib/async.js:23:69
at FSReqWrap.oncomplete (fs.js:152:21)
This is the first time I've tried to build an app using Parcel and I'm lost. I'm using node-sass to import my sass files directly -- perhaps this has something to do with that.
The referenced file (main.scss) is referenced in App.js like this
import "../../styles/main.scss";
and is the first sass file to be included (App is loaded into the DOM like this in index.js:
const store = configureStore()
ReactDOM.render(
<Provider store={store}>
<App />
</Provider>,
document.getElementById("root")
)
This is running under Node 11.15. My package.json follows -- any hints or help much appreciated!
{
"name": "friender",
"version": "1.0.0",
"description": "",
"main": "index.js",
"jest": {
"setupFiles": ["jest-localstorage-mock"]
},
"scripts": {
"dev": "parcel ./src/index.html",
"build": "parcel build ./src/index.html",
"lint": "eslint \"src/**/*.{js,jsx}\" --quiet",
"test": "jest"
},
"prettier": {
"semi": false
},
"keywords": [],
"author": "",
"license": "MIT",
"devDependencies": {
"#babel/cli": "^7.6.0",
"#babel/core": "^7.6.0",
"#babel/plugin-transform-runtime": "^7.5.5",
"#babel/preset-env": "^7.6.0",
"#types/jest": "^24.0.18",
"babel-eslint": "^10.0.3",
"babel-preset-react": "^7.0.0-beta.3",
"eslint": "^6.2.2",
"eslint-config-prettier": "^6.1.0",
"jest": "^24.9.0",
"jest-localstorage-mock": "^2.4.0",
"parcel-bundler": "^1.12.3",
"prettier": "^1.18.2"
},
"dependencies": {
"#emotion/babel-preset-css-prop": "^10.0.14",
"#emotion/core": "^10.0.16",
"#emotion/styled": "^10.0.15",
"#fortawesome/fontawesome-svg-core": "^1.2.0-7",
"#fortawesome/free-solid-svg-icons": "^5.11.1",
"#fortawesome/react-fontawesome": "^0.1.4",
"axios": "^0.19.0",
"bulma": "^0.7.5",
"eslint-plugin-jest": "^22.17.0",
"eslint-plugin-react": "^7.14.3",
"immer": "^4.0.0",
"node-sass": "^4.12.0",
"prop-types": "^15.7.2",
"react": "16.x",
"react-detect-offline": "^2.4.0",
"react-dom": "^16.9.0",
"react-fontawesome": "^1.6.1",
"react-modal": "^3.10.1",
"react-redux": "^7.1.1",
"redux": "^4.0.4",
"redux-devtools-extension": "^2.13.8",
"redux-thunk": "^2.3.0"
}
}
Try instead per the documentation for SCSS and error Cannot find module 'sass' use module sass instead of node-sass:
npm install -D sass
The documentation mentions being able to use node-sass, but there are several active issues with node-sass. Module sass may help resolve the error and allow you use SCSS in your application.
Hopefully that helps!

Warning on node showing wrong node version. Could it cause sqlite3 Error?

When running npm install I get the warning message:
npm WARN engine module#0.0.1: wanted: {"node":">= 0.2.9 < 0.7.0"} (current: {"node":"0.12.2","npm":"2.7.4"})
But in the package.json is specified node 5.3.0 (pls. see below)
Why does the message tell me the version 0.12 when the current version is 5.3?
Could it be the case for the error with sqlite3? I get the message:
Error: Cannot find module '...\node-v47-win32-x64\node_sqlite3.node'
at Function.Module._resolveFilename (module.js:326:15)
But in fact npm intall creates me node-v14-win32-x64 not node-v47-win32-x64 directory.
{
"name": "aesku-hera",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "supervisor ./bin/www"
},
"engines": {
"node": "5.3.0",
"npm": "2.7.4"
},
"dependencies": {
"body-parser": "^1.12.4",
"connect-busboy": "0.0.2",
"cookie-parser": "~1.3.5",
"debug": "~2.2.0",
"execsql": "0.0.3",
"express": "~4.12.4",
"gm": "^1.18.1",
"jade": "^1.9.2",
"jsonfile": "^2.2.3",
"module": "0.0.1",
"moment": "^2.10.3",
"morgan": "~1.5.3",
"multer": "0.1.6",
"node-hl7": "^0.1.3",
"node-json-db": "^0.6.3",
"node-mv": "^0.1.3",
"periodic-task": "^0.1.0",
"pg": "^4.4.0",
"request": "^2.58.0",
"serve-favicon": "~2.2.1",
"sqlite3": "^3.1.1",
"string": "^3.3.0"
}
}
The engines section in your package.json is just an indicator of which engine (like node) and the version your code would work on - see the documentation for more details.
It is most likely that your locally installed Node is version 0.12. You should upgrade it to 5.3.0 or higher and then try reinstalling your packages.
You can quickly verify your Node version by using the command -
node -v

"babelHelpers.asyncToGenerator is not a function" on React-Native 0.16.0 and 0.17.0

I updated React-Native from 0.14.0 to 0.16.0 and from now, I have errors at runtime:
Here are the npm dependencies:
"dependencies": {
"async": "^1.5.0",
"immutable": "^3.7.6",
"react-native": "^0.16.0",
"react-native-contacts": "../../react-native-contacts",
"react-native-contacts-rx": "^1.0.1",
"react-native-gifted-messenger": "0.0.7",
"react-native-i18n": "0.0.6",
"react-redux": "^4.0.1",
"redux": "^3.0.5",
"rx": "^4.0.7"
},
"devDependencies": {
"babel-eslint": "^5.0.0-beta6",
"eslint": "^1.10.3",
"eslint-config-airbnb": "^2.1.1",
"eslint-plugin-react": "^3.11.3",
"events": "^1.1.0",
"flux": "^2.1.1",
"keymirror": "^0.1.1",
"lodash": "^3.10.1",
"redux-devtools": "^3.0.0"
}
And my .babelrc file:
{
"retainLines": true,
"compact": true,
"comments": false,
}
Any suggestions?
The Questions was answered in an issue #Jean Lebrument submitted. Positing answer here for stumblers like myself...
https://github.com/facebook/react-native/issues/4844
The problem is most likely in your .babelrc file. If you experience this problem, compare your .babelrc file to react natives default one. Try removing the file or building off of default one, adding the features that you need.
Make sure to restart your packager, stop, and re-run your project.
I had this exact same problem you can check out what I did here - https://stackoverflow.com/a/53069785/2884655
But in short I just imported the babel-plugin-transform-async-to-generator module into my project and added it into my babelrc file

Resources