‘cross-env’ Is Not Recognized as an Internal or External Command in Laravel

Hello guys, welcome back to KDJ Guru. I hope you all are fine with the current situation which is called Corona. Anyways, these days, I’m learning a lot of things from home for my company. While learning period, I’m getting so many problems with the coding stuff. However, this is another problem which I got, when I tried to generate Vue Components from Laravel Passport. Anyways, the Laravel script worked perfectly. But, NPM part didn’t.

However, I’m not going to say the whole error and how it came. By the way, I will guide you to solve this if you got this.

first You need to make cross-env working globally instead of having it in the project.

  • Remove the node_modules folder first (If it’s in the folder)
  • Run the following command.
npm install --global cross-env
  • 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.
  • Run the following command.
npm install --no-bin-links
  • After all, you have to run the following command as the final step.
npm run dev

This is not just a blog post which teaches you without doing it by the author. I faced this issue and these steps will surely help you to solve it. But sometimes, the solution can be different according to the situation. If you got any issue, please let me know. I will reply as soon as possible.

Thank you for being with KDJ Guru Blog. Stay at home and Be safe.