Question

Node js as root and sudo user

  • Posted on July 18, 2013
  • mayu3gAsked by mayu3g

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


Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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.