I used to install packages globally (npm i -g truffle anyone?) but have now moved to installing locally as I often need different versions between projects.
I recently came across npx (I am new to the JavaScript world, sorry if this is really old news). npx is a npm package runner which is installed along with npm.
This allows me to run local packages easily and even run packages I havenβt installed.
I also did a check of what I had installed globally. npm list -g --depth 0
I then uninstalled everything I didnβt absolutely need globally, which was pretty much everything.
Installing globally may cause issues when different projects require different versions, configurations, etc., and makes the whole project environment harder to reproduce (because it assumes global state). The only benefit is not having to type npx, so local installation is a big win for me.