I can't run npm packages globally on my windows machine

  • Page Owner: Not Set
  • Last Reviewed: 2020-10-09

I’m probably an idiot and everybody else already knows this. I ran into an issue on my windows machine where I would install a package globally using -g however when I went to try and use the command windows didn’t recognize it. Super annoying.


Answer

Here is what solved it for me. First you have to go find out where node actually installed your global package at, for me it was at C:\Users\Chris\AppData\Roaming\npm

In that directory I found all those packages that I installed globally but was never able to access.

In order to access them I found out that I needed to update my “Path” system environment variable. The Path environment variable is a variable that specifies a set of directories where executable programs are located.

After adding the path to where node was installing my packages globally and restarting my computer, I was able to call them from the command line.

Wow thanks Chris this has been a thorn in my side for a long time.

You’re welcome other Chris.