简体   繁体   中英

Installing nodejs via nvm fails

I spend a lot of time and tons pages...

I have a an strange issue while installing nodejs on ubuntu 14.04 server (via nvm). When i run "nvm install 0.12.7" nvm gives me an answer:

curl: (6) Could not resolve host: nodejs.org
grep: /root/.nvm/bin/node-v0.12.7-linux-x86/node-v0.12.7-linux-x86.tar.gz: No such file or folder
Binary download failed, trying source.
nvm: install v0.12.7 failed!

If i type "nvm install 0.12.7" one more time, i got answer message:

Version '0.12.7' - not found - try 'nvm ls-remote' to browser available versions

I was try to install all available versions, also with -s postfix, but has a same error. I was try to install nodejs with sudo & from root. Same error. I was try uninstall and reinstall nvm with sudo and from root. Same error.

If i re-login and type nvm instal..... - I'll get a first fail, then second and so on.

I can install nodejs using apt-get, but i need to use nvm, it must be able to test project on many nodejs versus installed. Hope for help!

Instructions to Install Nodejs latest Version for Ubuntu via NVM:

Ps - In order to Unistall NVM:

rm -rf $NVM_DIR ~/.npm ~/.bower

Start With This:

  1. curl -o-https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash

Exit the Terminal and Start Again

  1. nvm install 14.4.0 (or your preferable version)

3.... sudo rm -rf /var/lib/apt/lists/* sudo rm -rf /etc/apt/sources.list.d/* sudo apt-get update

4... curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -

5... sudo apt-get install -y nodejs

6.. sudo apt install build-essential

I also had the same issue on ubuntu 14.04. Simply append v in front of version. That is the command will be nvm install v0.12.7 . And it worked like charm for me!

Manually adding the . ~/.nvm/nvm.sh (or bash ~/.nvm/nvm.sh) . ~/.nvm/nvm.sh (or bash ~/.nvm/nvm.sh) causes it to complain: N/A: version "N/A" is not yet installed. Even nvm list causes this error.

对我来说,当我手动添加版本目录时它起作用了😕

mkdir ~/.nvm/versions

On that link https://github.com/nvm-sh/nvm/issues/2771 was exactly what happened to me. I just uninstalled the curl snap package and installed it again using apt and finally removed nvm and reinstalled it again, all following the instructions on their github repo https://github.com/nvm-sh/nvm#uninstalling--removal

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM