Laravel 5.4 ‘cross-env’ Is Not Recognized as an Internal or External Command
Stefan Izdrail
Founder & Senior Architect · 2026-06-29
Title: Understanding 'cross-env' Not Recognized Error in Laravel Mix
Body:
Laravel is an impressive PHP framework that allows developers to build powerful web applications in a simple and elegant manner. One of the tools used for asset management within this framework is Laravel Mix, which uses npm run dev to execute a development task. But sometimes, the process can be interrupted by an error message: "cross-env" is not recognized as an internal or external command.
Troubleshooting 'cross-env' Not Recognized Error
1. Ensure your environment supports Node.js: First, check if your operating system and version support Node.js. Make sure you have the right version of Node.js installed on your computer. If it is not already installed, download and install it from Node.js official website. 2. Run a clean npm cache: Clear the npm cache by running these commands in the command prompt or terminal window:npm cache clear --forcenpm cache verify
rm -rf node_modules && npm cache clear --forcenpm install
npm install -g cross-env --save-dev
5. Update Laravel Mix version: Sometimes, an incorrect combination of Node and npm versions can cause the issue. Check the current Laravel Mix version by running node_modules/.bin/laravel-mix ls. If it's not the latest one, update Laravel Mix using:
npm install -S laravel-mix@latest
6. Update dependencies: Ensure that all of your project's dependencies are up-to-date by running a clean npm cache and updating dependencies:
npm update --forcenpm install