When trying to install Laravel Mix, it decides to bring in dependencies using npm
.
Is it possible to tell it to use yarn instead?
Specifically, it's this command that's pulling in dependencies.
node_modules/.bin/webpack --config=node_modules/laravel-mix/setup/webpack.config.js
I'm afraid it doesn't look like this is possible. I have just been looking into this myself because I use Yarn to manage my project dependencies and also noticed that Mix was forcing the use of NPM.
https://github.com/JeffreyWay/laravel-mix/issues/2196
It turns out there was a conscious decision to exclusively use NPM. It seems that Mix previously catered for both package managers until this commit https://github.com/JeffreyWay/laravel-mix/commit/adf6524efddf1f8a5ef659e4bf801ba0adbbe369
If Mix has been installing its required dependencies with NPM then I have taken the following steps via command line:
rm -rf package-lock.json
(Delete package-lock file)rm -rf node_modules
(Delete node_modules directory)yarn
(Reinstall updated dependencies with Yarn)I have just been upgrading dependencies in a project and I upgraded to Laravel Mix version 6.0.13. I found that Mix started to automatically install dependencies with Yarn. Therefore, the new solution is to upgrade to version 6 if you can.
If you decide to upgrade then please review this documentation in the process https://github.com/JeffreyWay/laravel-mix/blob/628f6062cceb77610b1813e3179abcbd043a4642/UPGRADE.md