Operating system and version: Ubuntu 18.04.1 + zsh + oh-my-zsh
nvm debug output:
nvm --version: v0.34.0
$SHELL: /usr/bin/zsh
$SHLVL: 1
$HOME: /home/matheus
$NVM_DIR: '$HOME/.nvm'
$PATH: $HOME/.sdkman/candidates/gradle/current/bin:$NVM_DIR/versions/node/v10.15.0/bin:$HOME/.rvm/gems/ruby-2.4.1/bin:$HOME/.rvm/gems/ruby-2.4.1@global/bin:$HOME/.rvm/rubies/ruby-2.4.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:$HOME/.rvm/bin:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:$HOME/Android/Sdk/tools:$HOME/Android/Sdk/platform-tools/:$HOME/.rvm/bin:$HOME/.rvm/bin:$HOME/Android/Sdk/tools:$HOME/Android/Sdk/platform-tools
$PREFIX: ''
$NPM_CONFIG_PREFIX: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'zsh 5.4.2 (x86_64-ubuntu-linux-gnu)'
uname -a: 'Linux 4.15.0-43-generic #46-Ubuntu SMP Thu Dec 6 14:45:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux'
OS version: Ubuntu 18.04.1 LTS
curl: /usr/bin/curl, curl 7.58.0 (x86_64-pc-linux-gnu) libcurl/7.58.0 OpenSSL/1.1.0g zlib/1.2.11 libidn2/2.0.4 libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3
wget: /usr/bin/wget, GNU Wget 1.19.4 built on linux-gnu.
git: /usr/bin/git, git version 2.17.1
grep: grep: aliased to grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn} (grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn}), grep (GNU grep) 3.1
awk: /usr/bin/awk, GNU Awk 4.1.4, API: 1.1 (GNU MPFR 4.0.1, GNU MP 6.1.2)
sed: /bin/sed, sed (GNU sed) 4.4
cut: /usr/bin/cut, cut (GNU coreutils) 8.28
basename: /usr/bin/basename, basename (GNU coreutils) 8.28
rm: /bin/rm, rm (GNU coreutils) 8.28
mkdir: /bin/mkdir, mkdir (GNU coreutils) 8.28
xargs: /usr/bin/xargs, xargs (GNU findutils) 4.7.0-git
nvm current: v10.15.0
which node: $NVM_DIR/versions/node/v10.15.0/bin/node
which iojs: iojs not found
which npm: $NVM_DIR/versions/node/v10.15.0/bin/npm
npm config get prefix: $NVM_DIR/versions/node/v10.15.0
npm root -g: $NVM_DIR/versions/node/v10.15.0/lib/node_modules
nvm ls output:
v9.11.1
v9.11.2
v10.9.0
v10.11.0
-> v10.15.0
default -> node (-> v10.15.0)
node -> stable (-> v10.15.0) (default)
stable -> 10.15 (-> v10.15.0) (default)
iojs -> N/A (default)
unstable -> N/A (default)
lts/* -> lts/dubnium (-> v10.15.0)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.16.0 (-> N/A)
lts/carbon -> v8.15.0 (-> N/A)
lts/dubnium -> v10.15.0
How did you install nvm?
Install script from README
What steps did you perform?
Tried to uninstall older unused Node versions (9.11.1, 10.9.0, 10.11.0) running nvm uninstall 9.11.1, nvm uninstall 10.9
What happened?
Terminal closed showing the following error:
realloc(): invalid next size
What did you expect to happen?
Uninstall specified version.
Is there anything in any of your profile files (.bashrc, .bash_profile, .zshrc, etc) that modifies the PATH?
Yes, as I have entries for Android SDK, Java and others.
What happens if you set -x before running nvm uninstall 10.9? (it'll be a lot of output; let's hide it behind a <details>)
I can't copy the output, the terminal window closes when running nvm uninstall. What can I do to keep it open?
Ok, I have managed to keep it alive, here's the output.
+nvm_check_file_permissions:1> setopt local_options nonomatch
+nvm_check_file_permissions:2> FILE=/home/matheus/.nvm/versions/node/v10.9.0/lib/node_modules/cordova/node_modules/cordova-js/tasks/vendor/commonjs-tests/modules/1.0/nested/a/b
+nvm_check_file_permissions:3> [ -d /home/matheus/.nvm/versions/node/v10.9.0/lib/node_modules/cordova/node_modules/cordova-js/tasks/vendor/commonjs-tests/modules/1.0/nested/a/b ']'
+nvm_check_file_permissions:4> nvm_check_file_permissions /home/matheus/.nvm/versions/node/v10.9.0/lib/node_modules/cordova/node_modules/cordova-js/tasks/vendor/commonjs-tests/modules/1.0/nested/a/b
+nvm_check_file_permissions:1> nvm_is_zsh
+nvm_is_zsh:1> [ -n 5.4.2 ']'
+nvm_check_file_permissions:1> setopt local_options nonomatch
+nvm_check_file_permissions:2> FILE=/home/matheus/.nvm/versions/node/v10.9.0/lib/node_modules/cordova/node_modules/cordova-js/tasks/vendor/commonjs-tests/modules/1.0/nested/a/b/c
+nvm_check_file_permissions:3> [ -d /home/matheus/.nvm/versions/node/v10.9.0/lib/node_modules/cordova/node_modules/cordova-js/tasks/vendor/commonjs-tests/modules/1.0/nested/a/b/c ']'
+nvm_check_file_permissions:4> nvm_check_file_permissions /home/matheus/.nvm/versions/node/v10.9.0/lib/node_modules/cordova/node_modules/cordova-js/tasks/vendor/commonjs-tests/modules/1.0/nested/a/b/c
+nvm_check_file_permissions:1> nvm_is_zsh
+nvm_is_zsh:1> [ -n 5.4.2 ']'
+nvm_check_file_permissions:1> setopt local_options nonomatch
+nvm_check_file_permissions:2> FILE=/home/matheus/.nvm/versions/node/v10.9.0/lib/node_modules/cordova/node_modules/cordova-js/tasks/vendor/commonjs-tests/modules/1.0/nested/a/b/c/d.js
realloc(): invalid next size
[1] + 13429 abort (core dumped) nvm uninstall 10.9
+-zsh:5> nvm_prompt_info
+nvm_prompt_info:1> [[ -f /home/matheus/.nvm/nvm.sh ]]
+nvm_prompt_info:2> local nvm_prompt
+nvm_prompt_info:3> nvm_prompt=+nvm_prompt_info:3> node -v
+nvm_prompt_info:3> nvm_prompt=v10.15.0
+nvm_prompt_info:4> [[ v10.15.0x == x ]]
+nvm_prompt_info:5> nvm_prompt=10.15.0
+nvm_prompt_info:6> echo '%B⬡%b 10.15.0'
+-zsh:5> bureau_git_prompt
+bureau_git_prompt:1> bureau_git_branch
+bureau_git_branch:1> ref=+bureau_git_branch:1> git symbolic-ref HEAD
+bureau_git_branch:1> ref=''
+bureau_git_branch:2> ref=+bureau_git_branch:2> git rev-parse --short HEAD
+bureau_git_branch:2> ref=''
+bureau_git_branch:2> return
+bureau_git_prompt:1> local _branch=''
+bureau_git_prompt:2> bureau_git_status
+bureau_git_status:1> _STATUS=''
+bureau_git_status:4> _INDEX=+bureau_git_status:4> git status --porcelain
+bureau_git_status:4> _INDEX=''
+bureau_git_status:5> [[ -n '' ]]
+bureau_git_status:19> _STATUS=$'%{\C-[[01;32m%}✓%{\C-[[00m%}'
+bureau_git_status:23> _INDEX=+bureau_git_status:23> git status --porcelain -b
+bureau_git_status:23> _INDEX=''
+bureau_git_status:24> echo ''
+bureau_git_status:24> grep -q '^## .*ahead'
+bureau_git_status:27> echo ''
+bureau_git_status:27> grep -q '^## .*behind'
+bureau_git_status:30> echo ''
+bureau_git_status:30> grep -q '^## .*diverged'
+bureau_git_status:34> git rev-parse --verify refs/stash
+bureau_git_status:38> echo $'%{\C-[[01;32m%}✓%{\C-[[00m%}'
+bureau_git_prompt:2> local _status=$'%{\C-[[01;32m%}✓%{\C-[[00m%}'
+bureau_git_prompt:3> local _result=''
+bureau_git_prompt:4> [[ x != x ]]
+bureau_git_prompt:11> echo
I have not included most of the output, since it took all available lines from the terminal window, and that would be too much.
Thanks, so it's failing in nvm_check_file_permissions - presumably you can reproduce this with nvm_check_file_permissions "$(nvm_version_path v10.9.0)"?
Any chance /home/matheus/.nvm/versions/node/v10.9.0/lib/node_modules/cordova/node_modules/cordova-js/tasks/vendor/commonjs-tests/modules/1.0/nested contains some symlinks, or some files with weird permissions?
presumably you can reproduce this with
nvm_check_file_permissions "$(nvm_version_path v10.9.0)"?
Apparently not, without set -x there is no output whatsoever. With it, though, there are loads of outputs, but nothing that seems intereseting. It doesn't fail with that same error.
contains some symlinks, or some files with weird permissions?
Not that I could see. They are simple files with common permissions and my user is currently the owner of all of them. However I'm not quite sure how to look for those (I'm not that savvy with Linux).
I have noticed something interesting. When using Tab to autocomplete folders and Git branches, I'm getting the same realloc error. Is it something to do with zsh or oh-my-zsh, maybe?
That's entirely possible - you could try disabling the autocompletion temporarily and see if that makes a difference.
Sorry! I have had my laptop changed in the past couple of days and I'm not using a Linux system anymore. However, since I have access to my old one still, I will test it out during the weekend and follow up on the issue.
So I'm also seeing my 2 different terminals close when I run nvm uninstall 8.4. I'm also using zsh. nvm --version is 0.34.
$ nvm --version
0.34.0
$ set -x
$ nvm uninstall 8.4 &> log.txt
$ tail -n6 log.txt
+nvm_check_file_permissions:1> nvm_is_zsh
+nvm_is_zsh:1> [ -n 5.4.2 ']'
+nvm_check_file_permissions:1> setopt local_options nonomatch
+nvm_check_file_permissions:2> FILE=/home/nick/.nvm/versions/node/v8.4.0/lib/node_modules/npm/node_modules/libnpx/node_modules/yargs/node_modules/cliui/node_modules/string-width/node_modules/is-fullwidth-code-point/node_modules/number-is-nan
+nvm_check_file_permissions:3> [ -d /home/nick/.nvm/versions/node/v8.4.0/lib/node_modules/npm/node_modules/libnpx/node_modules/yargs/node_modules/cliui/node_modules/string-width/node_modules/is-fullwidth-code-point/node_modules/number-is-nan ']'
realloc(): invalid next size
I suspect this is a bug in zsh, simply exposed via nvm. Google-ing the above error message plush zsh turns up lots of hits.
Sounds like zsh 5.5 and newer fix this: https://github.com/rvm/rvm/issues/4214#issuecomment-398786401. I'm running:
➜ node-nanomsg git:(gypi) zsh --version
zsh 5.4.2 (x86_64-ubuntu-linux-gnu)
(I recommend the maintainers close this bug)