0

I have installed with nodejs through nvm on Centos 8 with root. Everything works as expected with root.
After useradd appUser and su appUser I not able to execute nvm, node, npm.
What needs to be done to give my appUser access to node?

Delcon
  • 2,355
  • 1
  • 20
  • 23

2 Answers2

1

I am going to answer my own question because of my findings.

  1. Do not install nvm as root! nvm is per user see here. Installation will fail later for an other user if installed as root.
  2. adduser and su to your appUser
  3. Install nvm: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash
  4. source ~/.bash_profile to set new PATH
  5. important! cd ~ or you get permission denied in step 6 see here
  6. install node: nvm install node

Repeat for all users you want node installed

Delcon
  • 2,355
  • 1
  • 20
  • 23
0

Have you tried the {node --v} command. If you have and the result might be one of the two:-

  1. Either you get the version successfully. In this case, you have to run all the commands with sudo or superuser.

  2. Or you get an error saying 'COMMAND NOT FOUND'. In this case, you have to reinstall node for that specific user.

PS: Try to provide a little more details!

Ashutosh Kumar
  • 830
  • 7
  • 19
  • I get the `bash: node: command not found`. If I have multiple users that I wand to enable to use node, would I really have to install it for everyone of them? – Delcon Dec 30 '19 at 06:12
  • @Delcon As of now! Yes by the default method of installation you are supposed to install node for different users separately! You can go through this link, which might help you https://dzone.com/articles/making-nodejs-available-to-all-users-with-nvm – Ashutosh Kumar Dec 30 '19 at 06:27
  • your linked document describes exactly my problem. Do you know if the solution can be used in CentOs also? – Delcon Dec 30 '19 at 06:47
  • It certainly is meant for CentOS. Try that ! – Ashutosh Kumar Dec 30 '19 at 12:51