I almost never install packages globally unless it’s something like yarn or yeoman. When you’re in the root of your Node/JS project, if you want to run something like mocha without an npm script, you’d do ./node_modules/.bin/mocha .

What I do to be able to just run e.g. mocha is I add ./node_modules/.bin to my path in my shell’s profile/config file and whenever I’m in any of my Node/JS projects, I can just run e.g. mocha .

Have any npm tips/tricks you want to share?

This post is also available on DEV.