I'm trying to reinstall nvm (as a new user) after uninstalling it (as root) but clearly it didn't work. Please tell me how to fix this.
user@site-beta:~/htdocs$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 13527 100 13527 0 0 105k 0 --:--:-- --:--:-- --:--:-- 105k
You have $NVM_DIR set to "/root/.nvm", but that directory does not exist. Check your profile files and environment.
Edit: my advice is to give up on NVM and just install node normally, because clearly NVM isnt making it any easier.
This usually happens when there was nvm already present under a different user profile on the same computer. Here's a simple set of steps that can help you resolve. Assuming you have access/rights on your computer to modify paths/directories and default variables.
export NVM_DIR="/home/USERNAME/.nvm"
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
source ~/.nvm/nvm.sh
nvm -v again:nvm -v
What worked for me was editing /root/.profile and changing the path of the NVM_DIR as root, change that line to this:
export NVM_DIR="/home/<USERNAME>/.nvm"
replace USERNAME with the account you would like to run the script with, then run
source /root/.profile
After that switch to the desired user account using su command:
su <USERNAME>
And finally run the nvm install script one more time:
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With