just did a new laravel install 5.7.19 and I couldn't compile my javascript. so I went to the laravel-mix website and it said to run 'rm package-lock.json yarn.lock'. So I looked inside the folder and it had a yarn.lock file. How was that created? ...well after deleting it, npm run dev, was able to compile.
You probably have yarn and npm installed. You should one of them for your project. So if you want to run npm run dev you need to use npm install. If you want to use yarn you can run yarn dev to compile and run yarn to download all dependencies.
Removing those files most of time fixes weird errors in general! Sometimes they don't have something to do with Laravel Mix
@bobbybouwmann this hit me recently too in slightly different circumstances. If mix sees a yarn.lock file it will try and run yarn - even if it's not installed (as far as I can tell). It hit me doing a CI build after I'd been debugging npm issues (again) and had used yarn as a test - then inside the CI build it didn't have yarn and started to crash.
I think some part of doing a laravel new triggers a yarn.lock file to be created too - so I'd guess it's related to the way mix works. I meant to put an issue on the mix github but then started drinking & eating all the food on earth in the run up to xmas ;-)
yarn.lock comes in the laravel package by default. I usually remove it right after laravel new someproject finishes and before running npm install. In a CI environment, I believe that the service looks for .lock files and depending on the service looks to run yarn or npm first.
Look like if you need to pull in dependencies for mix and use npm but have a yarn.lock file it tries yarn before defaulting to npm. Not an expert but I would imagine this causes issues.
The laravel installer downloads http://cabinet.laravel.com/latest.zip which has a yarn.lock and composer.lock files included in the archive. Might be worth a pr to include a --npm and --yarn arguments to delete the unneeded files from the installer.
Thoughts on how to handle a default? Leave both, favour npm?