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?
Asked
Active
Viewed 1,641 times
0

Delcon
- 2,355
- 1
- 20
- 23
-
[Read this thread](https://stackoverflow.com/a/61055974/6414273) to see how I solve the issue on my Linux server – bibincatchme Apr 06 '20 at 08:48
2 Answers
1
I am going to answer my own question because of my findings.
- Do not install nvm as root! nvm is per user see here. Installation will fail later for an other user if installed as root.
adduser
andsu
to your appUser- Install nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash
source ~/.bash_profile
to set new PATH- important!
cd ~
or you get permission denied in step 6 see here - 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:-
Either you get the version successfully. In this case, you have to run all the commands with sudo or superuser.
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
-