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

39,821

Solution 1

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

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

Solution 2

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

Solution 3

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

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

Solution 4

my problem was solved by following these steps

 npm install --g laravel-mix

npm install --g webpack-cli

Solution 5

npm install laravel-mix@latest --save-dev
Share:
39,821

Related videos on Youtube

Spiral
Author by

Spiral

Updated on April 08, 2022

Comments

  • Spiral
    Spiral about 2 years

    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
    
  • Spiral
    Spiral over 3 years
    Thanks alot dear @karl Hill. I was trying from morning but not find the solution you give me exact solution again thanks
  • rog
    rog almost 3 years
    @karl do I have to run this command every time I resume work? Everytime I run npm install it says 'mix' is not recognized as an internal or external command. Am I doing it wrong or is there another method to make it permanent?
  • Ihar Aliakseyenka
    Ihar Aliakseyenka almost 3 years
    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 version
  • realtebo
    realtebo over 2 years
    I resolved installing laravel-mix globally. Probably you should remove the 3rd line anyway
  • Abhijit Mondal Abhi
    Abhijit Mondal Abhi over 2 years
    Thanks for the solution
  • Wojtek Dmyszewicz
    Wojtek Dmyszewicz about 2 years
    npm fix audit did the trick
  • Developer-Felix
    Developer-Felix about 2 years
    Yeah this is fine you can just use the latest version of mix for laravel version 8. It works well.
  • Ikram Khizer
    Ikram Khizer about 2 years
    Dude after hours you saved my head from getting smashed to the wall.