Does it matter whether you install a global package with yarn global add PACKAGE
vs npm install -g PACKAGE
?
Is there any difference at all, like where files are installed? If yes, what is it?
The main difference between NPM and Yarn is the package installation process. Yarn installs packages in parallel. Yarn is optimized to fetch and install multiple packages at once. NPM will perform a serial installation process.
The Yarn maintainers recommend installing Yarn globally by using the NPM package manager, which is included by default with all Node. js installations.
A package should be installed globally when it provides an executable command that you run from the shell (CLI), and it's reused across projects. You can also install executable commands locally and run them using npx, but some packages are just better installed globally.
In terms of speed and performance Yarn is better than NPM because it performs parallel installation. Yarn is still more secure than NPM. However, Yarn uses more disk space than NPM.
So yes, you are right it is different. For npm
it is something like below
/Users/tarunlalwani/.nvm/versions/node/v9.2.0/lib
if you are using nvm
You can get this path using
$ npm config get prefix
/Users/tarunlalwani/.nvm/versions/node/v9.2.0
Where does npm install packages?
While yarn uses other paths
How to display yarn globally installed packages?
See this thread as well
https://github.com/yarnpkg/yarn/issues/2049
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With