DEV Community

KIranuknow
KIranuknow

Posted on

Issue with NPM Package Installing Globally

I was not able to install npm packages globally in mac os(using npm install -g), but able to install locally in the project. Installing locally in every project will increase the total node_modules folder size and for every project we need to install the same packages that will be tedious and unnecessary.

Here are the steps I performed.

I was using Homebrew to install node and npm. So,

  1. Used command npm config get prefix - check where the npm actually points to. If this points to /opt/homebrew

  2. Check if node_modules are installed in cd /usr/local/lib

  3. If (2) is true, brew remove npm and then brew install npm

  4. Now see if npm install -g express works

ref: https://stackoverflow.com/questions/22562041/global-installation-with-npm-doesnt-work-after-mac-os-x-mavericks-update

Top comments (0)

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay