Laravel Mix unknown option '--hide-modules' error
Stefan Izdrail
Founder & Senior Architect · 2026-06-29
When dealing with Laravel projects, you may encounter issues related to compiling React components using Laravel Mix due to unexpected errors during the development process. One such error that can be encountered is the unknown option '--hide-modules' error. In this comprehensive blog post, we will explore the reasons behind this error and provide practical solutions for your Laravel projects.
The Laravel Mix command line interface (CLI) is an essential tool for managing and compiling assets during the development of your Laravel project. However, it's not uncommon to encounter errors while running the development scripts. One such error could be the unknown option '--hide-modules'. To debug this issue, follow these steps:@ dev E:\MY PROJECTS\Samriddhi Institute npm run development
@ development E:\MY PROJECTS\Samriddhi Institute cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
[webpack-cli] Error: Unknown option '--hide-modules' [webpack-cli] Run 'webpack --help' to see available commands and options npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! @ development:
cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.jsnpm ERR! Exit status 2 npm ERR! npm ERR! Failed at the @ development script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! @ dev:
npm run developmentnpm ERR! Exit status 2 npm ERR! npm ERR! Failed at the @ dev script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.npm ERR! A complete log of this run can be found in: npm ERR!
C:\Users\RADHESHYAM\AppData\Roaming\npm-cache_logs\2021-09-17T05_52_36_957Z-debug.log npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! @ dev:npm run developmentnpm ERR! Exit status 2 npm ERR! npm ERR! Failed at the @ dev script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.npm ERR! A complete log of this run can be found in: npm ERR!
C:\Users\RADHESHYAM\AppData\Roaming\npm-cache_logs\2021-09-17T05_52_37_148Z-debug.log PS E:\MY PROJECTS\Samriddhi Institute>"
- Verify that you are using the latest versions of Laravel Mix and its dependencies. Some older versions might have deprecated options or contain bugs.
- Check the Laravel Mix documentation for any known issues or updates regarding the '--hide-modules' option, as it might be removed from future releases.
- If this error persists, ensure you are running Laravel and your local Laravel installations with compatible versions. Running outdated packages may lead to incompatibilities with newer libraries like Laravel Mix.
In some cases, the '--hide-modules' option might be mistakenly present in the command line arguments when executing development scripts. To correct this issue, replace the problematic command with the following version:
npm run watch --progress
This command will execute the 'watch' script with progress reporting enabled, which should resolve the '--hide-modules' error and allow your Laravel Mix scripts to function properly.
In conclusion, understanding and resolving unknown option errors in Laravel Mix is essential for a smooth development process. Always ensure you are using the latest versions of Laravel and its dependencies, verify compatibility between packages, and double-check any command line arguments to avoid potential issues like the '--hide-modules' error. By following these guidelines, your Laravel projects should remain stable and efficient.