laravel-mix: [6.*] webpack-cli Unknown argument and SyntaxError
- Laravel Mix Version: 6.0.0-beta-4
- Node Version: 10.16.3
- NPM Version: 6.9.0
- OS: macOS Catalina v10.15.7
Description:
After upgrading to Mix 6 beta 4, npm run dev produces an error like the following.
[webpack-cli] Unknown argument: --hide-modules
If I try to remove the flag, I ended up with another error.
[webpack-cli] SyntaxError: Unexpected token =
This is my NPM Scripts. It’s the default from the mix documentation website (installation page).
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
Steps To Reproduce:
From Mix version 5.0.5, upgrade to mix 6.0.0-beta.4 using:
npm install laravel-mix@6.0.0-beta.4 -D
Then npm run dev
Edit
It seems when creating a new Laravel app with laravel new command, and then upgrade to mix 6 using the same command npm install laravel-mix@6.0.0-beta.4 -D is producing the same error when trying to npm run dev.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 28
This worked for me upgrading from version 5*.
npm installnpm i --save-dev laravel-mix@latestchange scripts to:
--hide-modulesdoes not exist anymore in webpack-cli 4, you must remove it from command lineI think you shouldn’t change the scripts in package.json. Should be like this:
and then just run
npx mixornpx mix -pIf you use the mix v6-beta then you should use npx to run mix:
@ahmadmamdouh-10 After upgrading to mix 6, make sure to change your NPM scripts.
"scripts": { "dev": "npm run development", "development": "npx mix", "watch": "npx mix watch", "prod": "npm run production", "production": "npx mix -p" },Don’t forget to use the latest node version.
npm upgrade
Hi @calvin-cg,
I had the same problem as you. I had to update my node version to the latest stable from v10.19.0 to v12.18.4
Hope that fixes it.
I tried
npx mix, but it still produces the same error.[webpack-cli] SyntaxError: Unexpected token =