We may face this problem when we run npm command in a Laravel project, which is cross-env: command not found npm.

The problem is creating by cross-env package. So to make cross-env working globally instead of having it in the project.

1) delete node_modules folder

2) run the below command

npm install

3) remove "cross-env": "^5.0.1", from package.json file 

devDependencies section. Actually, you can skip this step and keep package.json intact. If you prefer.

4) run the below command

npm install –no-bin-links

5) run the below command

npm run dev

and see it working

N.B. Tested on Windows 10 with Laravel-5.4 and mac os bigsur with laravel 8.0

N.B.Windows 10 with Laravel-5.6 does not have this problem, thus updating is an alternative solution.

Useful Tags :