# Why use sudo to install node-red via npm?

**URL:** <https://discourse.nodered.org/t/why-use-sudo-to-install-node-red-via-npm/16320>\
**Category:** General\
**Created:** [4 October 2019 13:51 UTC](https://discourse.nodered.org/t/why-use-sudo-to-install-node-red-via-npm/16320 "2019-10-04T13:51:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![brianzelip](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/brianzelip/32/12823_2.png) [@brianzelip](https://discourse.nodered.org/u/brianzelip)\
**Post date:** [4 October 2019 13:51 UTC](https://discourse.nodered.org/t/why-use-sudo-to-install-node-red-via-npm/16320/1 "2019-10-04T13:51:47Z")

</div>

Hi! I just heard [Nick O'Leary on the JS Party podcast](https://changelog.com/jsparty/95) and am excited to try out Node-RED.

Why is using `sudo` the recommended method for npm installing on local computers? This recommendation used to be frequent some time ago, but over the last few years I've seen this trend go away.

Curious as to why the authors recommend this (I've never quite understood the implications one way or the other).

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [4 October 2019 13:57 UTC](https://discourse.nodered.org/t/why-use-sudo-to-install-node-red-via-npm/16320/2 "2019-10-04T13:57:22Z")

</div>

Hi @brianzelip

it depends largely on how your node environment is setup.

In many default installs of node.js, global modules are put under `/usr/lib` (or similar). That is a space you usually require administrative/root access in order to write to.

So to install node-red as a global module, you need to use `sudo` in order to be able to install there, as `sudo` runs the command with administrative privileges.

But if you use something like `nvm` to manage your local node install, then global modules are stored somewhere the regular user can write to, so you don't need to use `sudo`.
