Laravel 5.4 ‘cross-env’ Is Not Recognized as an Internal or External Command
Stefan Bogdanescu
Founder & Senior Architect · 2026-06-29
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
shell
npm install -g cross-env --save-devnode_modules/.bin/laravel-mix ls. If it's not the latest one, update Laravel Mix using:
shell
npm install -S laravel-mix@latestnpm update --forcenpm install