Updating Nodejs from root and have a non root user sees it

1

I have a system (Ubuntu) with a root user and a node user. The node user is used to lunch Nodejs applications and it has no root privileges for security reasons. The current version of Nodejs is 6. To update it I'm using N simple by: npm install -g n but that requires to be root, so:

sudo su -
npm install -g n
n lts //that installs it
n lts //that instruct the system to use it
node --version  //11 Thats great!

Now tho, when I return to the node user sudo su node - and I ask for the Nodejs version is still version 6, and if try to do n lts from node user it gives me a bunch of errors related with permission since N was installed from root (BTW I cannot install N from node user).

How do I need to approach this?

Domingo

Posted 2019-04-03T09:36:45.347

Reputation: 1 141

No answers