0

working with Laravel 8 and installed vue js 3 with the project as well and running laravel project with php artisan serve command as well. but when I tryed to start vue js for running vite with npm run dev got following error messages in the console

'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\Modaya\AppData\Roaming\npm-cache\_logs\2023-04-17T12_24_06_646Z-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.

how could I fix this problem?

I need good solutions here

package.json

{
    "private": true,
    "scripts": {
        "dev": "npm run development",
        "development": "mix",
        "watch": "mix watch",
        "watch-poll": "mix watch -- --watch-options-poll=1000",
        "hot": "mix watch --hot",
        "prod": "npm run production",
        "production": "mix --production"
    },
    "devDependencies": {
        "axios": "^0.21",
        "laravel-mix": "^6.0.6",
        "lodash": "^4.17.19",
        "postcss": "^8.1.14"
    },
    "dependencies": {
        "admin-lte": "^3.2.0",
        "vue": "^3.2.47"
    }
}
amaruwakoi
  • 43
  • 1
  • 7

1 Answers1

0

mix command not found - what is mix when i runned dev?

'mix' is not recognized as an internal or external command, operable program or batch file.

You have declared a dev command in your package.json file, which, when invoked as npm run dev, runs the associated commands. In this case, the code might be:

{
  "scripts": {
    "dev": "npm run development",
    "development": "mix",
  }
}
  1. call dev with npm run dev (you runned it)
  2. call development by dev (automated by associated command)
  3. call mix by development (automated by associated command)
  4. Get error: mix not found (error message on your console)

How to can add mix command to project?

So, running npm run dev actually starts the same thing as if you entered mix in the console. However, the mix command does not exist. This is because you have not installed the laravel-mix package.

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

IMPORTANT: Remember that just because the dependency name is listed in the package.json file doesn't mean that you have actually installed it! You can easily check this by running the npm install command!


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

rozsazoltan
  • 2,831
  • 2
  • 7
  • 20
  • i install npm again now when i run `npm run dev` got following messages here `1 WARNING in child compilations (Use 'stats.children: true' resp. '--stats-children' for more details) webpack compiled with 1 warning` – amaruwakoi Apr 18 '23 at 08:22
  • Read here for your new problem: https://stackoverflow.com/questions/72083968/1-warning-in-child-compilations-use-stats-children-true-resp-stats-child – rozsazoltan Apr 18 '23 at 08:40
  • 1
    okay sir your 1st and second comments solved my problem – amaruwakoi Apr 18 '23 at 09:23