Reputation: 13
I use node v20.9.0, npm v10.1.0
When I running npm run watch throws the following error:
[webpack-cli] TypeError: Cannot read properties of undefined (reading 'scripts') at Object. (c:\OSPanel\domains\dispatcher\webpack.mix.js:16:4) at Module._compile (node:internal/modules/cjs/loader:1241:14) at Module._extensions..js (node:internal/modules/cjs/loader:1295:10) at Module.load (node:internal/modules/cjs/loader:1091:32) at Module._load (node:internal/modules/cjs/loader:938:12) at Module.require (node:internal/modules/cjs/loader:1115:19) at require (node:internal/modules/helpers:130:18) at module.exports (c:\OSPanel\domains\dispatcher\node_modules\laravel- mix\setup\webpack.config.js:11:5) at loadConfigByPath (c:\OSPanel\domains\dispatcher\node_modules\webpack-cli\lib\webpack-cli.js:1445:37) at async Promise.all (index 0)
My package.json
"scripts": {
"dev": "npm run development",
"development": "mix",
"watch": "mix watch",
"watch-poll": "mix watch -- --watch-options-poll=1000",
"hot": "mix watch --hot",
"prod": "npm run production",
"production": "mix --production"
},
"devDependencies":
"axios": "^1.6.1",
"bootstrap-sass": "^3.3.7",
"cross-env": "^5.0.1",
"jquery": "^3.1.1",
"laravel-mix": "^6.0.49",
"lodash": "^4.17.4",
"vue": "^2.1.10",
"webpack": "^5.89.0",
"webpack-cli": "^5.1.4"
}
My webpack.mix.js
let mix = require('laravel-mix');
mix.js('resources/assets/js/app.js', 'public/js')
.sass('resources/assets/sass/app.scss', 'public/css').
mix.scripts([
'public/test/jquery.easing.1.3.js',
'public/test/retina-1.1.0.min.js',
'public/test/jquery.cookie.js',
'public/test/styleswitch.js',
'public/test/jquery.smartmenus.min.js',
'public/test/jquery.smartmenus.bootstrap.min.js',
'public/test/owl.carousel.min.js',
'public/test/jflickrfeed.js',
'public/test/jquery.magnific-popup.min.js',
'public/test/jquery.isotope.min.js',
'public/test/swipe.js',
'public/test/jquery.sticky.js',
'public/test/main.js',
],
'public/js/all.js').mix.scripts([
'public/test/fileinput.min.js',
'public/test/inputmask.js',
'public/test/jquery.inputmask.js',
'public/test/flash_message.js',
'public/test/select2.min.js',
'public/test/ru.js',
'public/test/text_area_counter.js',
'public/test/text_area_counter.js',
'public/test/file_input.js',
], 'public/js/libs.js');
How can I fix this error?
I try reinstalling webpack-cli and clearing the npm cache (npm cache clean --force) but it did not help
Upvotes: 0
Views: 334
Reputation: 13
The main problem were node-sass and node-gyp. Reinstalling node-gyp and downgrading laravel-mix to v1 and node to v16.20.2 solved it
Upvotes: 0