sh: 1: mix: not found
See original GitHub issueMix: Tried multiple 6,0 versions. Node: 12.19.0 NPM: 7.6.3 OS: Windows 10
Once again I am having issues with a new version of Laravel Mix.
npm run watch-poll
throws a “sh: 1: mix: not found” error.
Fresh Laravel 8.12 installation. Don’t have any colons in the folder name, Have tried deleting node_modules, clearing cache and reinstalling via both NPM and Yarn. Have tried updating Laravel Mix to the latest versions.
I’m using --no-bin-links because npm install never works without it.
Laravel 7 and Mix 5 work perfectly fine, in fact after Laravel 8 failed I tried a fresh Laravel 7 installation and had no issues.
{
"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": {
"bootstrap": "^5.0.0-beta2"
}
}
const mix = require('laravel-mix');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel applications. By default, we are compiling the CSS
| file for the application as well as bundling up all the JS files.
|
*/
mix.js('resources/js/app.js', 'public/js')
.sass('resources/sass/bootstrap.scss', 'public/css')
.sass('resources/sass/app.scss', 'public/css')
.version();
Issue Analytics
- State:
- Created 3 years ago
- Comments:9
Top Results From Across the Web
Laravel, NPM: Command "mix" not found - Stack Overflow
I tried many solutions but only this worked for me: First, update your laravel-mix npm install laravel-mix@latest.
Read more >sh: 1: mix: not found · Issue #2903 - GitHub
Have tried updating Laravel Mix to the latest versions. I'm using --no-bin-links because npm install never works without it. Laravel 7 and Mix...
Read more >mix: command not found (Laravel) error [Solved] | bobbyhadz
To solve the error "mix: command not found", make sure to install the laravel-mix package by opening your terminal in your project's root...
Read more >mix: not found - Laracasts
Fresh installation of laravel 8, Jetstream and Livewire and I'm getting below error. How to resolve it? Thank you. npm run dev. @...
Read more >[Solved]-Laravel, NPM: Command "mix" not found-laravel
Best method to fix mix not found error is to reinstall npm using the command: npm clean-install. Digi Coder 56. score:8. You will...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This has to do with the no bin links on windows and the syntax of the new package.json file. I solved this by doing the following:
Full answer here: https://stackoverflow.com/a/67574817/1272667
If I remember correctly, before mix 6 there was no
mix
command, therefore you maybe just did not encounter an underlaying problem. It is very likely that the problem is not mix specific. As your OS is Win 10 and the error comes fromsh
it seems you somehow messed up with WSL and cmd/powershell?I know the issue in general and few of my problems in the past were:
npm install
with cmd/powershell but thennpm run ...
in WSL: The files created in node_modules/.bin are somehow not correct (I think it has to do with linux/windows links and shell-scripts)node_modules/.bin
is created and you find amix
andmix.cmd
andmix.ps1
in it (afternpm i
from powershell)npx mix
on your console in your project root, see if that worksAnother ugly issue I had was, that somehow node wanted to do something in global installed packages (even though I did install them locally). Then (in good dirty windows manner) there was a file path somewhere in my %USERPROFILE% directory, whereas my username was like “Firstname Lastname” which then caused problems due to the whitespace.
But as I said, to what you wrote that seem not to be mix-related.