skip to Main Content

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?

2

Answers


  1. Chosen as BEST ANSWER

    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


  2. 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!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search