Skip to content

Permission denied when trying to install the plugin #14

Description

@dmitriz

Trying to follow the installation instructions
https://github.com/lukechilds/zsh-nvm#as-an-oh-my-zsh-custom-plugin
and added to .zshrc:

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git)
plugins+=(zsh-nvm)
...
source $ZSH/oh-my-zsh.sh
...

but still getting the error

source .zshrc   
Installing nvm...
fatal: could not create leading directories of '/Users/dmitrizaitsev/.nvm': Permission denied
_zsh_nvm_install:cd:3: no such file or directory: /Users/dmitrizaitsev/.nvm

Any help?

Activity

lukechilds commented on Dec 6, 2016

@lukechilds
Owner

Sorry traveling atm, so might not be that responsive.

Do you already have nvm installed?

self-assigned this
on Dec 6, 2016

dmitriz commented on Dec 6, 2016

@dmitriz
Author

I have managed to install with homebrew.

lukechilds commented on Dec 7, 2016

@lukechilds
Owner

Homebrew installation isn't officially supported by nvm.

Happy to help you get this resolved if you're still interested.

dmitriz commented on Dec 7, 2016

@dmitriz
Author

I surely would be interested what was the problem with the supported installation ;)

lukechilds commented on Dec 9, 2016

@lukechilds
Owner

It appears to be an issue with git not having permission to create the /Users/dmitrizaitsev/.nvm folder to clone nvm into. Weird question but did the session you ran source .zshrc from definitely have write access to your home folder?

dmitriz commented on Dec 9, 2016

@dmitriz
Author

I suppose it does.
E.g. when I put mkdir ~/.test inside .zshrc and execute source .zshrc, the directory .test is created with no problems.

Only with plugins+=(zsh-nvm) I can see that problem,
now that the directory is created, here are the error messages:

source .zshrc
Installing nvm...
fatal: destination path '/Users/zaitsev/.nvm' already exists and is not an empty directory.
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
error: pathspec '' did not match any file(s) known to git.

lukechilds commented on Dec 9, 2016

@lukechilds
Owner

Hmmn, what OS and git version are you running?

dmitriz commented on Dec 9, 2016

@dmitriz
Author

Mac OSX 10.10.5 and git version 2.6.2

lukechilds commented on Dec 9, 2016

@lukechilds
Owner

I don't seem to be able to recreate the issue, the only way I can get the same error as you is if I try and clone into a folder I don't have write access to.

What happens if you run: git clone https://github.com/creationix/nvm.git ~/.test-nvm?

dmitriz commented on Dec 9, 2016

@dmitriz
Author

No problem:

git clone https://github.com/creationix/nvm.git ~/.test-nvm
Cloning into '/Users/zaitsev/.test-nvm'...
remote: Counting objects: 6025, done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 6025 (delta 5), reused 0 (delta 0), pack-reused 6012
Receiving objects: 100% (6025/6025), 1.71 MiB | 247.00 KiB/s, done.
Resolving deltas: 100% (3751/3751), done.
Checking connectivity... done.

lukechilds commented on Dec 9, 2016

@lukechilds
Owner

Do you currently have your brew install in ~/.nvm?

dmitriz commented on Dec 9, 2016

@dmitriz
Author

Yes, it worked with brew indeed, and ~/.nvm was created, no problem.

lukechilds commented on Dec 9, 2016

@lukechilds
Owner

Ok, could you try adding:

export NVM_DIR="$HOME/.test-zsh-nvm"

to .zshrc before source $ZSH/oh-my-zsh.sh?

dmitriz commented on Dec 9, 2016

@dmitriz
Author

Working ;)

source ~/.zshrc                                            
Installing nvm...
Cloning into '/Users/zaitsev/.test-zsh-nvm'...
remote: Counting objects: 6025, done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 6025 (delta 5), reused 0 (delta 0), pack-reused 6012
Receiving objects: 100% (6025/6025), 1.71 MiB | 1.35 MiB/s, done.
Resolving deltas: 100% (3751/3751), done.
Checking connectivity... done.

lukechilds commented on Dec 9, 2016

@lukechilds
Owner

Hmmmn, that shouldn't be any different to the original install (other than the folder), NVM_DIR will default to "$HOME/.nvm" if it's not set.

If you delete that line from .zshrc and brew uninstall node (make sure that removes ~/.nvm) it should work.

Just re-source ~/.zshrc and it should install into ~/.nvm.

dmitriz commented on Dec 9, 2016

@dmitriz
Author

I've moved away my .nvm and indeed that is working now. Strange...
Thanks in any case, for looking into it and your help!

lukechilds commented on Dec 10, 2016

@lukechilds
Owner

No problem, seems like it was an issue with your environment rather than nvm, glad it's working now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions