$ npm run build --demo1
> keenthemes@1.0.0 build
> webpack
[webpack-cli] Failed to load 'C:\Users\HP.DESKTOP-GRB4CUS\Documents\work project\Rural Farmers Hub\capture-django\_keenthemes\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 'C:\Users\HP.DESKTOP-GRB4CUS\Documents\work project\Rural Farmers Hub\capture-django\_keenthemes\tools\package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
at file:///C:/Users/HP.DESKTOP-GRB4CUS/Documents/work%20project/Rural%20Farmers%20Hub/capture-django/_keenthemes/tools/webpack.config.js:2:17
at ModuleJob.run (node:internal/modules/esm/module_job:197:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:337:24)
at async importModuleDynamicallyWrapper (node:internal/vm/module:437:15)
at async WebpackCLI.tryRequireThenImport (C:\Users\HP.DESKTOP-GRB4CUS\Documents\work project\Rural Farmers Hub\capture-django\_keenthemes\tools\node_modules\webpack-cli\lib\webpack-cli.js:213:26)
at async loadConfigByPath (C:\Users\HP.DESKTOP-GRB4CUS\Documents\work project\Rural Farmers Hub\capture-django\_keenthemes\tools\node_modules\webpack-cli\lib\webpack-cli.js:1404:27)
at async WebpackCLI.loadConfig (C:\Users\HP.DESKTOP-GRB4CUS\Documents\work project\Rural Farmers Hub\capture-django\_keenthemes\tools\node_modules\webpack-cli\lib\webpack-cli.js:1510:38)
at async WebpackCLI.createCompiler (C:\Users\HP.DESKTOP-GRB4CUS\Documents\work project\Rural Farmers Hub\capture-django\_keenthemes\tools\node_modules\webpack-cli\lib\webpack-cli.js:1785:22)
at async WebpackCLI.runWebpack (C:\Users\HP.DESKTOP-GRB4CUS\Documents\work project\Rural Farmers Hub\capture-django\_keenthemes\tools\node_modules\webpack-cli\lib\webpack-cli.js:1890:20)
Hi
Sorry for the delay.
https://gist.github.com/KeenthemesHub/4286143fcb481a3327b0918bf3d0a555
Could you please use this file package.json file and replace the file here;starterkit/_keenthemes/tools/package.json
Probably, there is a 3rd party plugin that has been outdated. This issue should be fixed in the latest version.
Thanks
Hi,
Could you please show your package.json? By right, remove "type": "module"
should work for webpack build.
Thanks
here it is
{
"name": "keenthemes",
"version": "1.0.0",
"author": "Keenthemes",
"license": "ISC",
"homepage": "https://keenthemes.com/",
"description": "Packages used by yarn, npm, gulp and webpack",
"main": "gulpfile.js",
"dependencies": {
"@ckeditor/ckeditor5-alignment": "^34.0.0",
"@ckeditor/ckeditor5-build-balloon": "^34.0.0",
"@ckeditor/ckeditor5-build-balloon-block": "^34.0.0",
"@ckeditor/ckeditor5-build-classic": "^34.0.0",
"@ckeditor/ckeditor5-build-decoupled-document": "^34.0.0",
"@ckeditor/ckeditor5-build-inline": "^34.0.0",
"@fortawesome/fontawesome-free": "^6.1.1",
"@popperjs/core": "^2.11.5",
"@shopify/draggable": "^1.0.0-beta.12",
"@yaireo/tagify": "^4.9.2",
"acorn": "^8.0.4",
"apexcharts": "^3.33.1",
"autosize": "^5.0.1",
"axios": "^0.21.1",
"bootstrap": "5.2.2",
"bootstrap-cookie-alert": "^1.2.1",
"bootstrap-daterangepicker": "^3.1.0",
"bootstrap-icons": "^1.5.0",
"bootstrap-maxlength": "^1.10.1",
"bootstrap-multiselectsplitter": "^1.0.4",
"chalk": "^4.1.0",
"chart.js": "^3.6.0",
"clipboard": "^2.0.8",
"countup.js": "^2.0.7",
"cropperjs": "^1.5.12",
"datatables.net": "^1.12.1",
"datatables.net-bs5": "^1.12.1",
"datatables.net-buttons": "^2.2.3",
"datatables.net-buttons-bs5": "^2.2.3",
"datatables.net-colreorder": "^1.5.6",
"datatables.net-colreorder-bs5": "^1.5.6",
"datatables.net-datetime": "^1.1.2",
"datatables.net-fixedcolumns": "^4.1.0",
"datatables.net-fixedcolumns-bs5": "^4.1.0",
"datatables.net-fixedheader": "^3.2.3",
"datatables.net-fixedheader-bs5": "^3.2.3",
"datatables.net-plugins": "^1.11.5",
"datatables.net-responsive": "^2.3.0",
"datatables.net-responsive-bs5": "^2.3.0",
"datatables.net-rowgroup": "^1.2.0",
"datatables.net-rowgroup-bs5": "^1.2.0",
"datatables.net-rowreorder": "^1.2.8",
"datatables.net-rowreorder-bs5": "^1.2.8",
"datatables.net-scroller": "^2.0.6",
"datatables.net-scroller-bs5": "^2.0.6",
"datatables.net-select": "^1.4.0",
"datatables.net-select-bs5": "^1.4.0",
"dropzone": "^5.9.2",
"es6-promise": "^4.2.8",
"es6-promise-polyfill": "^1.2.0",
"es6-shim": "^0.35.5",
"esri-leaflet": "^3.0.2",
"esri-leaflet-geocoder": "^3.0.0",
"flatpickr": "^4.6.9",
"flot": "^4.2.2",
"fslightbox": "^3.3.0-2",
"fullcalendar": "^5.8.0",
"handlebars": "^4.7.7",
"inputmask": "^5.0.6",
"jkanban": "^1.3.1",
"jquery": "3.6.0",
"jquery.repeater": "^1.2.1",
"jstree": "^3.3.11",
"jszip": "^3.6.0",
"leaflet": "^1.7.1",
"line-awesome": "^1.3.0",
"moment": "^2.29.1",
"nouislider": "^15.2.0",
"npm": "^9.1.2",
"pdfmake": "^0.2.0",
"prism-themes": "^1.7.0",
"prismjs": "^1.24.1",
"quill": "^1.3.7",
"select2": "^4.1.0-rc.0",
"smooth-scroll": "^16.1.3",
"sweetalert2": "11.4.8",
"tiny-slider": "^2.9.3",
"tinymce": "^5.8.2",
"toastr": "^2.1.4",
"typed.js": "^2.0.12",
"vis-timeline": "^7.4.9",
"wnumb": "^1.2.0"
},
"devDependencies": {
"@babel/core": "^7.13.14",
"@babel/plugin-transform-modules-commonjs": "^7.13.8",
"@babel/preset-env": "^7.13.12",
"@babel/register": "^7.13.14",
"copy-webpack-plugin": "^8.1.0",
"css-loader": "^5.2.0",
"css-minimizer-webpack-plugin": "^4.2.2",
"del": "^6.0.0",
"extract-loader": "^5.1.0",
"file-loader": "^6.2.0",
"fs-extra": "^10.0.0",
"gulp": "^3.9.1",
"gulp-clean-css": "^4.3.0",
"gulp-concat": "^2.6.1",
"gulp-connect": "^5.7.0",
"gulp-dart-sass": "^1.0.2",
"gulp-if": "^3.0.0",
"gulp-rename": "^2.0.0",
"gulp-rewrite-css": "^1.1.2",
"gulp-rtlcss": "^2.0.0",
"gulp-sourcemaps": "^3.0.0",
"gulp-terser": "^2.0.1",
"imports-loader": "^1.2.0",
"lazypipe": "^1.0.2",
"merge-stream": "^2.0.0",
"mini-css-extract-plugin": "^1.3.4",
"postcss-loader": "^4.0.4",
"pretty": "^2.0.0",
"replace-in-file-webpack-plugin": "^1.0.6",
"rtlcss-webpack-plugin": "^4.0.6",
"sass-loader": "^10.1.0",
"script-loader": "^0.7.2",
"terser-webpack-plugin": "^5.0.3",
"url-loader": "^4.1.1",
"webpack": "^5.75.0",
"webpack-cli": "^4.6.0",
"webpack-dev-server": "^4.11.1",
"webpack-exclude-assets-plugin": "^0.1.1",
"webpack-merge-and-include-globally": "^2.3.4",
"webpack-messages": "^2.0.4",
"yargs": "^16.2.0",
"yarn-install": "^1.0.0"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack",
"watch": "webpack --watch",
"localhost": "webpack serve",
"sync": "node sync.js"
}
}
Hi,
As stated in the documentation https://preview.keenthemes.com/html/metronic/docs/getting-started/build/webpack
Have you removed "type": "module"
from /tools/package.json file?
Thanks
I did that and I still got this error
$ webpack
[webpack-cli] Failed to load 'C:\Users\HP.DESKTOP-GRB4CUS\Documents\work project\Rural Farmers Hub\capture-django\_keenthemes\tools\webpack.config.js' config
[webpack-cli] Error: Cannot find module 'webpack-log'
Require stack:
- C:\Users\HP.DESKTOP-GRB4CUS\Documents\work project\Rural Farmers Hub\capture-django\_keenthemes\tools\node_modules\webpack-exclude-assets-plugin\lib\index.js
- C:\Users\HP.DESKTOP-GRB4CUS\Documents\work project\Rural Farmers Hub\capture-django\_keenthemes\tools\node_modules\webpack-exclude-assets-plugin\index.js
- C:\Users\HP.DESKTOP-GRB4CUS\Documents\work project\Rural Farmers Hub\capture-django\_keenthemes\tools\webpack.config.js
- C:\Users\HP.DESKTOP-GRB4CUS\Documents\work project\Rural Farmers Hub\capture-django\_keenthemes\tools\node_modules\webpack-cli\lib\webpack-cli.js
- C:\Users\HP.DESKTOP-GRB4CUS\Documents\work project\Rural Farmers Hub\capture-django\_keenthemes\tools\node_modules\webpack-cli\lib\bootstrap.js
- C:\Users\HP.DESKTOP-GRB4CUS\Documents\work project\Rural Farmers Hub\capture-django\_keenthemes\tools\node_modules\webpack-cli\bin\cli.js
- C:\Users\HP.DESKTOP-GRB4CUS\Documents\work project\Rural Farmers Hub\capture-django\_keenthemes\tools\node_modules\webpack\bin\webpack.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (C:\Users\HP.DESKTOP-GRB4CUS\Documents\work project\Rural Farmers Hub\capture-django\_keenthemes\tools\node_modules\webpack-exclude-assets-plugin\lib\index.js:1:16)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\HP.DESKTOP-GRB4CUS\\Documents\\work project\\Rural Farmers Hub\\capture-django\\_keenthemes\\tools\\node_modules\\webpack-exclude-assets-plugin\\lib\\index.js',
'C:\\Users\\HP.DESKTOP-GRB4CUS\\Documents\\work project\\Rural Farmers Hub\\capture-django\\_keenthemes\\tools\\node_modules\\webpack-exclude-assets-plugin\\index.js',
'C:\\Users\\HP.DESKTOP-GRB4CUS\\Documents\\work project\\Rural Farmers Hub\\capture-django\\_keenthemes\\tools\\webpack.config.js',
'C:\\Users\\HP.DESKTOP-GRB4CUS\\Documents\\work project\\Rural Farmers Hub\\capture-django\\_keenthemes\\tools\\node_modules\\webpack-cli\\lib\\webpack-cli.js',
'C:\\Users\\HP.DESKTOP-GRB4CUS\\Documents\\work project\\Rural Farmers Hub\\capture-django\\_keenthemes\\tools\\node_modules\\webpack-cli\\lib\\bootstrap.js',
'C:\\Users\\HP.DESKTOP-GRB4CUS\\Documents\\work project\\Rural Farmers Hub\\capture-django\\_keenthemes\\tools\\node_modules\\webpack-cli\\bin\\cli.js',
'C:\\Users\\HP.DESKTOP-GRB4CUS\\Documents\\work project\\Rural Farmers Hub\\capture-django\\_keenthemes\\tools\\node_modules\\webpack\\bin\\webpack.js'
]
}
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.