Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

HubertVanD's avatar

'cross-env' is not recognized as an internal or external command,

I'm building a Laravel 8 project using Vue2. The initial problem was that Chrome dev tools did recognize Vue, but does not show the root component.

When I ran npm run dev in the root of my project, I got an error message:

> @ development C:\xampp\htdocs\api-frontend
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js

'cross-env' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
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! A complete log of this run can be found in:
npm ERR!     C:\Users\Hubert\AppData\Roaming\npm-cache\_logs20-12-11T19_14_02_023Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ dev: `npm run development`
npm ERR! Exit status 1
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\Hubert\AppData\Roaming\npm-cache\_logs20-12-11T19_14_02_042Z-debug.log

Most likely it is an obvious error I make, but I don't see it!

Any suggestions?

Hubert

0 likes
6 replies
apex1's avatar

Have you tried running npm install first?

HubertVanD's avatar

Solved in meanwhile:

  • removes node_modules folder
  • removed package-lock.json
  • ran npm install
1 like
piljac1's avatar

There's no need to remove package-lock.json in this case. It's actually not recommended because it is what locks your versions into place to have a consistent environment everywhere.

You have to main ways to fix the error:

  1. Install cross-env
npm install --save-dev cross-env
  1. Remove node_modules, then run npm install (don't remove package-lock.json in the first place).

If both options don't work, you can try option 2 while removing package-lock.json before running npm install, but that's the last resort.

2 likes
HubertVanD's avatar

Thanx. I'll try it.

The worrying thing is of course that I have to do this anyhow. It already happened twice this week for the same Laravel project.

Any idea what I may be doing wrong?

Hubert

Please or to participate in this conversation.