Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't uninstall global npm package #1219

Closed
ninjasort opened this issue Sep 2, 2016 · 31 comments
Closed

Can't uninstall global npm package #1219

ninjasort opened this issue Sep 2, 2016 · 31 comments
Labels
needs followup We need some info or action from whoever filed this issue/PR.

Comments

@ninjasort
Copy link

I'm trying to uninstall a package with npm uninstall -g <package> but it's not removing it from .nvm/versions/node/v6.0.0/bin/<package>

@ljharb
Copy link
Member

ljharb commented Sep 2, 2016

What's nvm debug and npm root -g say? When you installed that package, did you use sudo? (you never want to use sudo with nvm)

@ljharb ljharb added the needs followup We need some info or action from whoever filed this issue/PR. label Sep 2, 2016
@ninjasort
Copy link
Author

$ nvm debug
nvm --version: v0.31.0
$SHELL: /bin/bash
$HOME: /Users/cameronroe
$NVM_DIR: '$HOME/.nvm'
$PREFIX: ''
$NPM_CONFIG_PREFIX: ''
nvm current: v6.0.0
which node: $NVM_DIR/versions/node/v6.0.0/bin/node
which iojs: 
which npm: $NVM_DIR/versions/node/v6.0.0/bin/npm
npm config get prefix: $NVM_DIR/versions/node/v6.0.0
npm root -g: $NVM_DIR/versions/node/v6.0.0/lib/node_modules

$ npm root -g
/Users/cameronroe/.nvm/versions/node/v6.0.0/lib/node_modules

@ljharb
Copy link
Member

ljharb commented Sep 2, 2016

Try chown -R "$(whoami)": "$(npm root -g)" (you may need sudo for it) and then npm uninstall -g <packagename> again?

@ninjasort
Copy link
Author

I think it removed it, but the shell didn't update after uninstall.

@ninjasort
Copy link
Author

Now I get this on login: -bash: /usr/local/Cellar/nvm/0.31.6/nvm.sh: No such file or directory

@ljharb
Copy link
Member

ljharb commented Sep 2, 2016

Ah, "Cellar" - did you previously install nvm with homebrew? If so, you may want to remove all of the nvm-related lines from your profile files, and then rerun the install script in the readme.

@ninjasort
Copy link
Author

Yeah, I did though.

@ljharb
Copy link
Member

ljharb commented Sep 2, 2016

hmm - that line must exist somewhere, otherwise it wouldn't try to source that file :-/

@ninjasort
Copy link
Author

Okay, so I had some strange configuration because now that I've removed the brew version, I still have a .nvm and it's giving me this when I try to install.

=> Downloading nvm from git to '/Users/cameronjroe/.nvm'
=> fatal: destination path '/Users/cameronjroe/.nvm' already exists and is not an empty directory.
Failed to clone nvm repo. Please report this!

@ljharb
Copy link
Member

ljharb commented Sep 2, 2016

Ah, that's fixed in 68bf935 but not yet released in master. Try curl -o- https://raw.githubusercontent.com/creationix/nvm/68bf93514bdf5d2852ce74819350bed99eb472a6/install.sh | bash to work around that for now?

@ninjasort
Copy link
Author

I did that and I get this:

$ nvm
-bash: nvm: command not found

@ljharb
Copy link
Member

ljharb commented Sep 2, 2016

After restarting your terminal?

Can you verify the nvm-related lines in one of your profile files, and in which one?

@ninjasort
Copy link
Author

I have a .bash_profile with:

# nvm/node
export NVM_DIR=~/.nvm
export NODE_ENV='development'

.bashrc with:

export NVM_DIR="/Users/cameronjroe/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"  # This loads nvm

@ninjasort
Copy link
Author

$ which nvm gives nothing

@ljharb
Copy link
Member

ljharb commented Sep 2, 2016

ok so, in bash_profile - remove that NVM_DIR line entirely, the one in .bashrc is correct. which nvm isn't supposed to give anything, because nvm is a shell function and not a binary. type nvm should, however.

@ninjasort
Copy link
Author

still nothing

@ninjasort
Copy link
Author

opened a new shell too

@ninjasort
Copy link
Author

I also keep seeing this in new shell windows on login -bash: /usr/local/Cellar/nvm/0.31.6/nvm.sh: No such file or directory

@ljharb
Copy link
Member

ljharb commented Sep 2, 2016

Can you gist the entire contents of .bash_profile and .bashrc? Feel free to asterisk out any sensitive parts.

@ljharb
Copy link
Member

ljharb commented Sep 2, 2016

Also, make sure to run brew uninstall nvm

@ninjasort
Copy link
Author

I did find this source $(brew --prefix nvm)/nvm.sh

@ljharb
Copy link
Member

ljharb commented Sep 2, 2016

Ah, please remove that line :-)

@ninjasort
Copy link
Author

Ah, okay turned out my .bashrc wasn't sourced in my .bash_profile

@ljharb
Copy link
Member

ljharb commented Sep 2, 2016

that'd do it :-) you definitely want to add that also.

@ninjasort
Copy link
Author

Would this be messing it up in .bashrc -> [ -n "$PS1" ] && source ~/.bash_profile

@ljharb
Copy link
Member

ljharb commented Sep 2, 2016

yes, generally you want bash_profile to source bashrc, not the other way around.

@ninjasort
Copy link
Author

Awesome, got it. Thanks!

@ljharb
Copy link
Member

ljharb commented Sep 2, 2016

np, let me know if it's still not all working!

@ljharb ljharb closed this as completed Sep 3, 2016
@tanzeelrana

This comment has been minimized.

@ljharb

This comment has been minimized.

@tanzeelrana

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs followup We need some info or action from whoever filed this issue/PR.
Projects
None yet
Development

No branches or pull requests

3 participants