Report this

What is the reason for this report?

Node js as root and sudo user

Posted on July 18, 2013

I installed the node.js as root user yesterday things are fine out there if I login as root user (Ubuntu 13.04 64 bit). As you know we don’t wanna mess up with root user so created a sudo user and tried node command and found that it doesn’t work for the new user.

Is it normal or am I doing something wrong??

PS : Now I’m reinstalling nodejs for the sudo userr



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi - a recent article has some good info on how to run Node. Give it it a read - you may find it useful: https://www.digitalocean.com/community/articles/how-to-use-pm2-to-setup-a-node-js-production-environment-on-an-ubuntu-vps

NodeJS is installed locally by default. You can run the installer as root and have it installed globally so all users can run it.

I think when you install node it places the node modules folder in the current users main directory. This means that if you created another user that cannot see inside the root folder node stops working correctly. <br> <br>Most people advise against installing elements that don’t require root- as root. Therefore, you’ll probably be better off creating a normal simple user with a main directory as something like /home/. Then from there install NodeJs as that new simple user.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.