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

7

63

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
Soothfast answered 18/1, 2021 at 17:33 Comment(0)
G
142

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

npm install laravel-mix@latest --save-dev
Garda answered 18/1, 2021 at 17:39 Comment(0)
R
29

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
Rosin answered 3/4, 2021 at 4:57 Comment(1)
It is npm audit fix not npm fix auditLiterature
I
3

my problem was solved by following these steps

 npm install --g laravel-mix

npm install --g webpack-cli
Iodoform answered 1/7, 2021 at 20:17 Comment(2)
Installing webpack globally is not recommended webpack.js.org/guides/installation/#global-installation. Note that this is [webpack global installation] not a recommended practice. Installing globally locks you down to a specific version of webpack and could fail in projects that use a different versionFavored
I resolved installing laravel-mix globally. Probably you should remove the 3rd line anywayJaleesa
S
1

First delete node_modules directory and run below command one be one

npm cache clean --force

npm install

npm install --g laravel-mix

npm install --g webpack-cli

npm run development
Settee answered 10/5, 2023 at 13:51 Comment(0)
T
-2

NPM INSTALL it will repair it It hapenned because you have some stuff installed after previous NMP I

So, in any strange situation - NPM INSTALL again)

Touchwood answered 13/1, 2023 at 22:55 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Towill
C
-4

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

Copy answered 17/5, 2021 at 6:20 Comment(0)
I
-5

If you are a windows user try this :

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

then :

npm cache verify
Isologous answered 6/3, 2021 at 18:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.