Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
I recently fresh-installed Ubuntu 21.04 and wanted to install nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
Then closed and re-opened the terminal. When requesting an install of version
12.16.3
(have tried with other versions as well). I'm getting the following error:
nvm install 12.16.3
Downloading and installing node v12.16.3...
Downloading https://nodejs.org/dist/v12.16.3/node-v12.16.3-linux-x64.tar.xz...
Warning: Failed to create the file
Warning: /home/sauronnikko/.nvm/.cache/bin/node-v12.16.3-linux-x64/node-v12.16.
Warning: 3-linux-x64.tar.xz: Permission denied
curl: (23) Failure writing output to destination
Binary download from https://nodejs.org/dist/v12.16.3/node-v12.16.3-linux-x64.tar.xz failed, trying source.
grep: /home/sauronnikko/.nvm/.cache/bin/node-v12.16.3-linux-x64/node-v12.16.3-linux-x64.tar.xz: No such file or directory
Provided file to checksum does not exist.
Binary download failed, trying source.
Downloading https://nodejs.org/dist/v12.16.3/node-v12.16.3.tar.xz...
Warning: Failed to create the file
Warning: /home/sauronnikko/.nvm/.cache/src/node-v12.16.3/node-v12.16.3.tar.xz:
Warning: Permission denied
curl: (23) Failure writing output to destination
Binary download from https://nodejs.org/dist/v12.16.3/node-v12.16.3.tar.xz failed, trying source.
grep: /home/sauronnikko/.nvm/.cache/src/node-v12.16.3/node-v12.16.3.tar.xz: No such file or directory
Provided file to checksum does not exist.
I had the same issue. It was due to the lack of "libssl-dev". Run the following command before you start the installation process for nvm
sudo apt-get install build-essential libssl-dev curl git-core
I had the same issue (having previously installed curl with snap). After UNinstalling curl nvm worked as expected.
$ sudo snap remove curl
–
I have had the exact same issue today as well, I'm not sure if its been an issue with NVM or if its just my Linux install being screwy but I have managed to get around it for the moment by manually downloading the tar file for the node version you want to install, move it to nvm's cache and then running nvm install again. I'll leave exact steps below and I'll try and remember to come back and update this Q if I work out why curl doesnt want to create a file in the .nvm dir
I have tried everything I can think of to try allow curl to save to the nvm directory, installing nvm using sudo, chown the dir, add full rwx permissions for user group and other for the dir, manually install nvm, nothing had worked for me so at present my best solution is below :)
Work around fix (using v16.1.0 of node as the example):
1 - run the curl command to download the version of node you want into your home directory
curl https://nodejs.org/dist/v16.1.0/node-v16.1.0-linux-x64.tar.xz --output node-v16.1.0-linux-x64.tar.xz
2 - copy the file to the nvm cache
sudo mv node-v16.1.0-linux-x64.tar.xz ~/.nvm/.cache/bin/node-v16.1.0-linux-x64/node-v16.1.0-linux-x64.tar.xz
3 - run nvm install again
nvm install node (or whatever version you are trying to install)
This will delete curl that was installed through snap.
We need to install using apt
>sudo apt-get install curl
Now we need to install nvm using curl
>curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
Now simply install the node version u want.
>nvm install v14.17.0
In order to list all nvm version simply do so.
>nvm ls
And in order to switch just type the following command.
>nvm use v12.X.XX
Note :In my case, I passed these steps, but I got another permission error during installation of a node version with nvm, and solved it by using this command:
sudo chmod 777 /private/tmp
For me the problem was different, and the solution was to create an SSH Key for GitHub and add it in my profile.
See related documentation here
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.