How to install NPM packages globally without sudo

Pablo Verlly
Dec 31, 2021

--

mkdir -p ~/.local && npm set prefix ~/.local

Restart the terminal to apply the changes.

Packages will now be installed in “~/.local/lib/node_modules”.

--

--

Pablo Verlly
Pablo Verlly

Written by Pablo Verlly

~ F̶u̶l̶l̶ ̶s̶t̶a̶c̶k̶ developer ~ Cybersecurity s̶p̶e̶c̶i̶a̶l̶i̶s̶t̶ ~ Web Scraping E̶x̶p̶e̶r̶t̶