Every trying all steps i get error in "npm run build --rtl --demo1"
Failed to load 'E:\metronic_html_v8.2.2_demo1\tools\webpack.config.js' config
[webpack-cli] ReferenceError: require is not defined in ES module scope, you can use import instead
This file is being treated as an ES module because it has a '.js' file extension and 'E:\metronic_html_v8.2.2_demo1\tools\package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
at file:///E:/metronic_html_v8.2.2_demo1/tools/webpack.config.js:1:17
at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:530:24)
at async importModuleDynamicallyWrapper (node:internal/vm/module:438:15)
at async WebpackCLI.tryRequireThenImport (E:\metronic_html_v8.2.2_demo1\tools\node_modules\webpack-cli\lib\webpack-cli.js:232:34)
at async loadConfigByPath (E:\metronic_html_v8.2.2_demo1\tools\node_modules\webpack-cli\lib\webpack-cli.js:1406:27)
at async WebpackCLI.loadConfig (E:\metronic_html_v8.2.2_demo1\tools\node_modules\webpack-cli\lib\webpack-cli.js:1515:38)
at async WebpackCLI.createCompiler (E:\metronic_html_v8.2.2_demo1\tools\node_modules\webpack-cli\lib\webpack-cli.js:1781:22)
at async WebpackCLI.runWebpack (E:\metronic_html_v8.2.2_demo1\tools\node_modules\webpack-cli\lib\webpack-cli.js:1877:20)
Hi,
Open your package.json file.
Look for the "type" property. It might look something like this:
{
"type": "module",
// ... other package.json configurations
}
Hi Faizal,
I removed this "type": "module" and retried with the build command.
npm run build --rtl --demo1
PS E:\metronic_html_v8.2.2_demo1\tools> npm run build --rtl --demo1
npm WARN cli npm v10.2.5 does not support Node.js v16.20.2. This version of npm supports the following node versions: `^18.17.0 || >=20.5.0`. You can find the latest version at https://nodejs.org/.
> keenthemes@8.2.2 build
> webpack
[webpack-cli] Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration[0].entry["js/widgets.bundle"] should be a non-empty array.
-> All modules are loaded upon startup. The last one is exported.
PS E:\metronic_html_v8.2.2_demo1\tools>
The error message stating that you are using Node.js v16.20.2. Please consider upgrading it to v18 or v20.
Also, please try using cmd command console instead of power shell.
Thanks