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>
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)
$ 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
Try chown -R "$(whoami)": "$(npm root -g)" (you may need sudo for it) and then npm uninstall -g <packagename> again?
I think it removed it, but the shell didn't update after uninstall.
Now I get this on login: -bash: /usr/local/Cellar/nvm/0.31.6/nvm.sh: No such file or directory
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.
Yeah, I did though.
hmm - that line must exist somewhere, otherwise it wouldn't try to source that file :-/
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!
Ah, that's fixed in 68bf93514bdf5d2852ce74819350bed99eb472a6 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?
I did that and I get this:
$ nvm
-bash: nvm: command not found
After restarting your terminal?
Can you verify the nvm-related lines in one of your profile files, and in which one?
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
$ which nvm gives nothing
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.
still nothing
opened a new shell too
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
Can you gist the entire contents of .bash_profile and .bashrc? Feel free to asterisk out any sensitive parts.
Also, make sure to run brew uninstall nvm
I did find this source $(brew --prefix nvm)/nvm.sh
Ah, please remove that line :-)
Ah, okay turned out my .bashrc wasn't sourced in my .bash_profile
that'd do it :-) you definitely want to add that also.
Would this be messing it up in .bashrc -> [ -n "$PS1" ] && source ~/.bash_profile
yes, generally you want bash_profile to source bashrc, not the other way around.
Awesome, got it. Thanks!
np, let me know if it's still not all working!
Not sure whats wrong with my npm but I can not use any packages i install using npm install -g <package>. Can someone please help
root@pace:~# nvm debug
nvm --version: v0.33.8
$SHELL: /bin/bash
$HOME: /root
$NVM_DIR: '$HOME/.nvm'
$PREFIX: ''
$NPM_CONFIG_PREFIX: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)'
uname -a: 'Linux 4.4.0-139-generic #165-Ubuntu SMP Wed Oct 24 10:58:50 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux'
OS version: Ubuntu 16.04.3 LTS
curl: /usr/bin/curl, curl 7.47.0 (x86_64-pc-linux-gnu) libcurl/7.47.0 GnuTLS/3.4.10 zlib/1.2.8 libidn/1.32 librtmp/2.3
wget: /usr/bin/wget, GNU Wget 1.17.1 built on linux-gnu.
git: /usr/bin/git, git version 2.7.4
grep: /bin/grep (grep --color=auto), grep (GNU grep) 2.25
sed: -e expression #1, char 9: Unmatched ) or \)
awk: , GNU Awk 4.1.3, API: 1.1 (GNU MPFR 3.1.4, GNU MP 6.1.0)
sed: /bin/sed, sed (GNU sed) 4.2.2
cut: /usr/bin/cut, cut (GNU coreutils) 8.25
basename: /usr/bin/basename, basename (GNU coreutils) 8.25
sed: -e expression #1, char 9: Unmatched ) or \)
rm: , rm (GNU coreutils) 8.25
sed: -e expression #1, char 9: Unmatched ) or \)
mkdir: , mkdir (GNU coreutils) 8.25
xargs: /usr/bin/xargs, xargs (GNU findutils) 4.7.0-git
nvm current: v8.9.4
which node: $NVM_DIR/versions/node/v8.9.4/bin/node
which iojs:
which npm: $NVM_DIR/versions/node/v8.9.4/bin/npm
npm config get prefix: $NVM_DIR/versions/node/v8.9.4
npm root -g: $NVM_DIR/versions/node/v8.9.4/lib/node_modules
root@pace:~# npm root -g
/root/.nvm/versions/node/v8.9.4/lib/node_modules
root@pace:~# npm root
/root/node_modules
You seem to have a node_modules folder in your home dir; I鈥檇 delete that. Either way tho, please file a new issue (and fill out the issue template) instead of commenting on this old, closed one, and I鈥檒l be happy to take a look.
Most helpful comment
I think it removed it, but the shell didn't update after uninstall.