Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

491
Visualizações
Laravel, NPM: Command "mix" not found

Does anyone have an idea why it throws the following error and how to fix it? I have also tried to reinstall all packages using npm install several times. Reinstalling NodeJS on Windows didn't work; I'm using Laravel 8.22.0.

enter image description here

Full Log

0 verbose cli [
0 verbose cli   'D:\\Programme\\NodeJS\\node.exe',
0 verbose cli   'D:\\Programme\\NodeJS\\node_modules\\npm\\bin\\npm-cli.js',
0 verbose cli   'run',
0 verbose cli   'development'
0 verbose cli ]
1 info using npm@7.3.0
2 info using node@v15.5.1
3 timing config:load:defaults Completed in 1ms
4 timing config:load:file:D:\Programme\NodeJS\node_modules\npm\npmrc Completed in 2ms
5 timing config:load:builtin Completed in 2ms
6 timing config:load:cli Completed in 1ms
7 timing config:load:env Completed in 0ms
8 timing config:load:file:D:\My\Path\.npmrc 33,,,,,,,,Completed in 0ms
9 timing config:load:project Completed in 1ms
10 timing config:load:file:C:\Users\Privat\.npmrc Completed in 1ms
11 timing config:load:user Completed in 1ms
12 timing config:load:file:C:\Users\Privat\AppData\Roaming\npm\etc\npmrc Completed in 0ms
13 timing config:load:global Completed in 0ms
14 timing config:load:cafile Completed in 0ms
15 timing config:load:validate Completed in 1ms
16 timing config:load:setUserAgent Completed in 0ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 8ms
19 verbose npm-session 8b04ab779a67efab
20 timing npm:load Completed in 18ms
21 timing command:run-script Completed in 23ms
22 verbose stack Error: command failed
22 verbose stack     at ChildProcess.<anonymous> 
(D:\Programme\NodeJS\node_modules\npm\node_modules\@npmcli\promise-spawn\index.js:64:27)
22 verbose stack     at ChildProcess.emit (node:events:376:20)
22 verbose stack     at maybeClose (node:internal/child_process:1063:16)
22 verbose stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:295:5)
23 verbose cwd D:\My\Path
24 verbose Windows_NT 10.0.19042
25 verbose argv "D:\\Programme\\NodeJS\\node.exe" "D:\\Programme\\NodeJS\\node_modules\\npm\\bin\\npm-cli.js" "run" "development"
26 verbose node v15.5.1
27 verbose npm  v7.3.0
28 error code 1
29 error path D:\My\Path\IDE
30 error command failed
31 error command C:\WINDOWS\system32\cmd.exe /d /s /c mix
32 verbose exit 1

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.1",
        "bootstrap": "^4.0.0",
        "clean-webpack-plugin": "^3.0.0",
        "cross-env": "^5.1",
        "jquery": "^3.2",
        "laravel-mix": "^5.0.5",
        "less": "^3.12.2",
        "less-loader": "^7.0.0",
        "lodash": "^4.17.13",
        "popper.js": "^1.12",
        "resolve-url-loader": "^3.1.2",
        "sass": "^1.20.1",
        "sass-loader": "7.*",
        "vue": "^2.5.17",
        "vue-template-compiler": "^2.6.10"
    },
    "dependencies": {
        "bootstrap-vue": "^2.21.2",
        "uglify-js": "^3.10.3"
    }
}
over 4 years ago · Santiago Trujillo
10 Respostas
Responde à pergunta

0

You will need to bump your Laravel Mix, SASS Loader dependencies to the latest and install PostCSS and Webpack.

npm i --save-dev laravel-mix@latest && 
npm i --save-dev sass-loader@latest && 
npm i --save-dev postcss@latest && 
npm i --save-dev webpack@latest

You should now have Laravel Mix version 6, so the only remaining step is to compile your assets. Then, use the new Mix executable or use npm.

npx mix -p

OR

npm run prod

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.1",
        "bootstrap": "^4.0.0",
        "bootstrap-vue": "^2.21.2",
        "clean-webpack-plugin": "^3.0.0",
        "cross-env": "^5.1",
        "jquery": "^3.2",
        "laravel-mix": "^6.0.9",
        "less": "^3.12.2",
        "less-loader": "^7.0.0",
        "lodash": "^4.17.13",
        "popper.js": "^1.12",
        "postcss": "^8.2.4",
        "resolve-url-loader": "^3.1.2",
        "sass": "^1.20.1",
        "sass-loader": "^10.1.1",
        "uglify-js": "^3.10.3",
        "vue": "^2.5.17",
        "vue-template-compiler": "^2.6.10",
        "webpack": "^5.14.0"
    }
}
over 4 years ago · Santiago Trujillo Relatório

0

In case somebody has a similar issue.

NPM is moody. Sometimes it's worth to try deleting all modules and install them again:

on Linux it's a simple command: rm -rf node_modules in a project root folder,

than just run npm install again.

over 4 years ago · Santiago Trujillo Relatório

0

Recently laravel mix has been update to laravel mix 6 so I would advise to check the current version of npm/node you are using and the try to upgrade it to the latest version.

npm -v

You can upgrade to the latest version of npm using:

npm install -g npm@latest

Or upgrade to the most recent release:

npm install -g npm@next
over 4 years ago · Santiago Trujillo Relatório

0

I tried many solutions but only this worked for me:

First, update your laravel-mix

npm install laravel-mix@latest

Then do a clean npm install:

npm clean-install

that should fix the laravel 8 mix error.

over 4 years ago · Santiago Trujillo Relatório

0

I had the same issue (Win 10 as host and Homestead in Vagrant). I tried the above but still got the error. The following ended up working for me:

  1. open up powershell as admin
  2. navigate to project root
  3. run this command
node c:\<path to node installation>\node_modules\npm\bin\npm-cli.js install --scripts-prepend-node-path=auto

In previous versions installing node packages from the vm into the mounted drive (with no bin links because windows) was okay, laravel mix would work. My guess is because the package.json file was more verbose and specified full paths - difference in package.json files here.

With the terse syntax in the new version it needs the bin link to follow the reference. Running the command without admin privileges failed for me because renaming files, might be different for you. Going forward this will need to be the new process for installing node packages (on host vs on vm).

over 4 years ago · Santiago Trujillo Relatório

0

I had the same problem after installing laravel/ui:

composer require laravel/ui
php artisan ui vue --auth

In this case there are two possible solutions:

  1. Simply delete the node_modules folder with RMDIR "FOLDERNAME" /S /Q and reinstall it with npm install
  2. run npm install only after laravel/ui and ui vue has installed (i know, sounds crazy, but that's exactly how it was for me)

After you have done one of the two points, do npm run dev.

over 4 years ago · Santiago Trujillo Relatório

0

npm install laravel-mix@latest

and you may need to install vue-loader legacy peer dependencies. Generally it gets installed or updated automatically during npm run dev

over 4 years ago · Santiago Trujillo Relatório

0

Best method to fix mix not found error is to reinstall npm using the command:
npm clean-install

over 4 years ago · Santiago Trujillo Relatório

0

I faced the same situation. After couple of hours finally got it working. What I did:

  1. Updated NPM npm install -g npm@latest
  2. Updated laravel-mix (6.0.31 at the moment of writing)
  3. Updated Vagrantfile https://laravel.com/docs/8.x/homestead#symbolic-links-on-windows
  4. Reload PC (vagrant reload --provision would probably be enough)
  5. Run terminal/phpstorm as admin
  6. Remove old node_modules, yarn.lock, package.lock, clear NPM cache
  7. IMPORTANT Use YARN! sudo yarn install then sudo yarn run dev
over 4 years ago · Santiago Trujillo Relatório

0

please run this command . Its works for me.

yarn install --ignore-engines
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda