NVM & Node.js - Recommended install for all users

后端 未结 6 1792

is there a recommended install for nvm so all users can use it? i cannot find anything on the web regarding this.

this is what i did

  • installed nvm in a
6条回答
  •  被撕碎了的回忆
    2020-12-07 10:44

    Install NVM on your Linux server, after that install node version using NVM (run all the command as root user). After that run the below command for all the users get nodejs available with nvm

    n=$(which node);n=${n%/bin/node}; chmod -R 755 $n/bin/*; sudo cp -r $n/{bin,lib,share} /usr/local
    

    The above command is a bit complicated, but all it’s doing is copying whatever version of node you have active via nvm into the /usr/local/ directory (where user installed global files should live on a linux VPS/server) and setting the permissions so that all users can access them.

    /root/.nvm/versions/node/v8.10.0/bin/node

    Switch the user name check your node version.

    su - username
    which node
    /usr/local/bin/node
    

提交回复
热议问题