# Installing npm from ports



## The Alchemist (Aug 10, 2017)

Hello everyone,

I have recently installed www/node and www/npm  using portmaster:
`$ sudo portmaster www/node www/npm`

This installation method causes npm to installed as root and thus install all packages using the root account...

Because this happens, a lot of permission issues arise.
I tried fixing this manually, but this caused npm to freeze the entire system (I/O lock) during installing packages.

Is there anyone that has done this successfully and could you help me set it up correctly?


----------



## The Alchemist (Aug 10, 2017)

One step further:

I can change npm to run only for a single user by changing the ownership of the following directory:
`$ sudo chown -R USER:USER /usr/local/lib/node_modules/npm`

This works, but now I can only use it with that user...

Any other idea's?


----------



## SirDice (Aug 10, 2017)

Just because packages are installed by root doesn't mean they run as root. Does your root account have a limited umask(1) perhaps? That may prevent the correct permissions being set during the install.


----------

