'mix' is not recognized as an internal or external command in Laravel 8 new installation

Viewed 50595

I have installed a new Laravel 8 application, and then I ran...

npm install

Afterward, I ran...

npm run dev

I get the following error.

'mix' is not recognized as an internal or external command


> @ dev E:\wamp64\www\Laravel8Projects\Laravel_Livewire_JetStream_Projects\jetstream_blog
> npm run development


> @ development E:\wamp64\www\Laravel8Projects\Laravel_Livewire_JetStream_Projects\jetstream_blog
> mix

'mix' 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: `mix` 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\HP\AppData\Roaming\npm-cache\_logs\2021-01-18T17_03_24_944Z-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\HP\AppData\Roaming\npm-cache\_logs\2021-01-18T17_03_24_980Z-debug.log
6 Answers

Likely you need to install the latest version of Laravel Mix.

npm install laravel-mix@latest --save-dev

It will happen when your cache holds previous files.Clear the cache and install the npm again

npm cache clean --force

then:

npm install

npm fix audit

then:

npm run development

my problem was solved by following these steps

 npm install --g laravel-mix

npm install --g webpack-cli

Just install the latest version of laravel mix wich will support verion 8

npm install laravel-mix@latest --save-dev

package.json requires you to run mix-watch command but it doesnt work

a simple fix that worked for me is running npm run watch it worked for me laravel 8 project

If you are a windows user try this :

C:\Users{{your-username}}\AppData\Roaming\npm-cache

then :

npm cache verify
Related