NVM无法在ubuntu 18.04上安装nodejs

Pas*_*hne 5 node.js nvm

我尝试在 ubuntu 18.04 上使用 nvm 安装nodejs。但每次它都会抛出以下错误堆栈

pasindu@pasindu-HP-EliteBook-850-G7-Notebook-PC:~$ nvm install 0.10.35

Downloading and installing node v0.10.35...
Downloading https://nodejs.org/dist/v0.10.35/node-v0.10.35-linux-x64.tar.gz...
Warning: Failed to create the file                                             
Warning: /home/pasindu/.nvm/.cache/bin/node-v0.10.35-linux-x64/node-v0.10.35-li
Warning: nux-x64.tar.gz: Permission denied
curl: (23) Failure writing output to destination

Binary download from https://nodejs.org/dist/v0.10.35/node-v0.10.35-linux-x64.tar.gz failed, trying source.
grep: /home/pasindu/.nvm/.cache/bin/node-v0.10.35-linux-x64/node-v0.10.35-linux-x64.tar.gz: No such file or directory
Provided file to checksum does not exist.
Binary download failed, trying source.
Detected that you have 12 CPU core(s)
Running with 11 threads to speed up the build
Downloading https://nodejs.org/dist/v0.10.35/node-v0.10.35.tar.gz...
Warning: Failed to create the file                                             
Warning: /home/pasindu/.nvm/.cache/src/node-v0.10.35/node-v0.10.35.tar.gz: 
Warning: Permission denied
curl: (23) Failure writing output to destination

Binary download from https://nodejs.org/dist/v0.10.35/node-v0.10.35.tar.gz failed, trying source.
grep: /home/pasindu/.nvm/.cache/src/node-v0.10.35/node-v0.10.35.tar.gz: No such file or directory
Provided file to checksum does not exist.
Run Code Online (Sandbox Code Playgroud)

Che*_*hao 25

可能是snap-curl的问题,看这里,因为我一开始用snap安装curl总是遇到这个问题,然后我用snap删除了curl并sudo snap remove curl重新安装sudo apt install curl,我现在的curl版本是7.68.0。然后解决了。

  • 刚刚在 Ubuntu 20.04 上遇到了这个问题。可以确认此答案也解决了 20.04 上的问题。 (3认同)