npm install -g is installing to a local folder

I have been using node and npm for a while, and I just started a larger scale project using it. Recently, however, whenever I run sudo npm install -g, it will install it into a ~/Programming/usr/local/bin instead of /usr/local/bin. Does anyone know why this is happening? How can I reset the installation location

You can set the location by running the following command.

npm config set prefix /usr/local