Nvm: Unable to install 'Permission denied'

Created on 20 Jul 2016  路  8Comments  路  Source: nvm-sh/nvm

I have run the install script and gotten the following error:

{Wed Jul 20 07:19:50 CDT 2016} <ScaryTerry.ttys000> (master) [dzimm at ~/Codes/]
[} curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.3/install.sh | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  9128  100  9128    0     0   5020      0  0:00:01  0:00:01 --:--:--  5018
=> Downloading nvm from git to '/Users/nad/.nvm'
=> mkdir: /Users/nad/.nvm: Permission denied
fatal: could not create leading directories of '/Users/nad/.nvm': Permission denied
Failed to clone nvm repo. Please report this!

Useful information about my machine:

{Wed Jul 20 07:25:55 CDT 2016} <ScaryTerry.ttys000> [dzimm at ~/Codes]
[} sw_vers
ProductName:    Mac OS X
ProductVersion: 10.11.4
BuildVersion:   15E65
{Wed Jul 20 07:26:27 CDT 2016} <ScaryTerry.ttys000> [dzimm at ~/Codes]
[} bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin15)
Copyright (C) 2007 Free Software Foundation, Inc.
installing nvm needs followup

Most helpful comment

This problem occurred to me as well. The problem was that I had imported my previous .bash_profile from my old machine. In it the file, I had export NVM_DIR="/Users/sghiassy/.nvm". On my new machine, my home directory was /Users/shaheen, and the conflicting user directory was causing the problem

The solution was to change the export to export NVM_DIR="$HOME/.nvm"

All 8 comments

@danzimm What is the output of whoami? If you are nad, then you should have full ownership and permissions on anything within ~nad, including .nvm. If not, then since nvm is per-user, NVM_DIR should be unset before trying to run the install script.

From the shell prompt, looks like @danzimm is using account dzimm on the environment, but nvm tried to install on nad's home, @danzimm can you provide the detail about the environment?

@danzimm do you perhaps have nad or dzimm hardcoded in your profile files somewhere?

I am getting similar error
fatal: could not create leading directories of '/home/suryakant/.nvm': Permission denied
Failed to clone nvm repo. Please report this!

@suryaZivame what does nvm debug and whoami say?

This problem occurred to me as well. The problem was that I had imported my previous .bash_profile from my old machine. In it the file, I had export NVM_DIR="/Users/sghiassy/.nvm". On my new machine, my home directory was /Users/shaheen, and the conflicting user directory was causing the problem

The solution was to change the export to export NVM_DIR="$HOME/.nvm"

Sorry for going dark - I can confirm the same thing that happened to @sghiassy happened to me. It looks like the nvm setup automatically adds export NVM_DIR="/path/to/home/.nvm" to your .bashrc. It seems like it should add export NVM_DIR="$HOME/.nvm" instead (it might be that $HOME isn't being escaped when that line is added and thus is being expanded at the time of setup).

The problem is that we need the fully expanded path for the install script, so we'd need to parse out $HOME later in order to actually add that literal text into the profile file.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

swateek picture swateek  路  3Comments

dtgriscom picture dtgriscom  路  4Comments

arnavb picture arnavb  路  3Comments

ksmithut picture ksmithut  路  3Comments

tongxiaofeng picture tongxiaofeng  路  5Comments