On a new machine, the configuration environment requires Node installation.
To make NVM available to all users, we obviously need to install NVM as root.
After the installation is complete, create the NVM. Sh file in the /etc/profile.d directory and write to
#! /usr/bin/env bash
export NVM_DIR="/usr/local/nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
Copy the code
Execute the script after writing.
Then you can use NVM for all users.
PS: This method can only be verified in Centos. Other systems need to be verified separately.
The resources
stackoverflow – nvm-node-js-recommended-install-for-all-users