简体   繁体   English

通过 nvm 安装 nodejs 失败

[英]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).在 ubuntu 14.04 服务器(通过 nvm)上安装 nodejs 时,我遇到了一个奇怪的问题。 When i run "nvm install 0.12.7" nvm gives me an answer:当我运行“nvm install 0.12.7”时,nvm 给了我一个答案:

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:如果我再输入一次“nvm install 0.12.7”,我会收到回复消息:

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.我试图安装所有可用版本,也使用 -s 后缀,但有同样的错误。 I was try to install nodejs with sudo & from root.我试图用 sudo 和 root 安装 nodejs。 Same error.同样的错误。 I was try uninstall and reinstall nvm with sudo and from root.我尝试使用 sudo 和 root 卸载并重新安装 nvm。 Same error.同样的错误。

If i re-login and type nvm instal..... - I'll get a first fail, then second and so on.如果我重新登录并键入 nvm instal..... - 我将首先失败,然后是第二次,依此类推。

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.我可以使用 apt-get 安装 nodejs,但我需要使用 nvm,它必须能够在许多 nodejs 上测试项目与安装。 Hope for help!希望得到帮助!

Instructions to Install Nodejs latest Version for Ubuntu via NVM:通过 NVM 为 Ubuntu 安装 Nodejs 最新版本的说明:

Ps - In order to Unistall NVM: Ps - 为了卸载 NVM:

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

Start With This:从这个开始:

  1. curl -o-https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | 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) nvm install 14.4.0(或您喜欢的版本)

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

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

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

6.. sudo apt install build-essential 6.. sudo apt install build-essential

I also had the same issue on ubuntu 14.04.我在 ubuntu 14.04 上也遇到了同样的问题。 Simply append v in front of version.只需在版本前附加 v 即可。 That is the command will be nvm install v0.12.7 .那就是命令将是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) . ~/.nvm/nvm.sh (or bash ~/.nvm/nvm.sh) causes it to complain: N/A: version "N/A" is not yet installed. . ~/.nvm/nvm.sh (or bash ~/.nvm/nvm.sh)导致它抱怨:N/A:版本“N/A”尚未安装。 Even nvm list causes this error.甚至 nvm list 也会导致此错误。

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

mkdir ~/.nvm/versions

On that link https://github.com/nvm-sh/nvm/issues/2771 was exactly what happened to me.在那个链接https://github.com/nvm-sh/nvm/issues/2771上正是发生在我身上的事情。 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我刚刚卸载了 curl snap 包并使用 apt 再次安装它,最后删除了 nvm 并再次重新安装,所有这些都按照他们的 github repo 上的说明进行https://github.com/nvm-sh/nvm#uninstalling--removal

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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