'NVM can not install nodejs on ubuntu 18.04

I Tried to install nodejs using nvm on ubuntu 18.04. But everytime it's throwing following error stack

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.


Solution 1:[1]

It may be the problem of snap curl, see here, cos I installed curl with snap at first and always encounter this problem, then I removed curl with sudo snap remove curl and reinstall it with sudo apt install curl, my current curl version is 7.68.0. then solved it.

Solution 2:[2]

I had to clear the cache: nvm cache clear.

I've got the error after I tried to install a version of Node, which I've tried to install already, however the installation processs failed at the first time due disconnecting from the internet.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Marten