npm add global package code example Example 1: install npm package globally npm install package-name -g Example 2: how to install npm packages globally npm i -g <package>