Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NVM: Getting Permission denied with nvm install command

Tags:

linux

node.js

nvm

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.
like image 388
sauronnikko Avatar asked May 14 '21 21:05

sauronnikko


People also ask

Does NVM require admin rights?

NVM (Node Version Manager) is the best way to run multiple versions of NodeJS on the same machine. It's not only for Windows but in this post I will talk about my experience to install NVM on a Windows machine without Admin Rights.

How install NVM-setup.exe as administrator?

Open a CMD prompt (run as administrator), and install the downloaded version of nvm, nvm-setup.exe, from within this CMD command prompt. From within the admin level command prompt, run "nvm install 7.2. 1", or whatever node version you want to install.


2 Answers

Posted an issue to nvm's repo

Turns out the problem was with curl and that I had installed it with snap instead of regular apt install curl.

like image 155
sauronnikko Avatar answered Sep 19 '22 19:09

sauronnikko


uninstall curl installed with snap

sudo snap remove curl

install curl from apt

sudo apt install curl
like image 23
Dr. Mukama Avatar answered Sep 18 '22 19:09

Dr. Mukama