nvm-sh / nvm

Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions
MIT License
79.08k stars 7.92k forks source link

nvm quited during `reinstall-packages` #2328

Open GopherJ opened 3 years ago

GopherJ commented 3 years ago

Operating system and version:

Linux Mint v19.3 cinamon

nvm debug output:

nvm --version: v0.34.0
$SHELL: /usr/bin/zsh
$SHLVL: 1
$HOME: /home/cheng
$NVM_DIR: '$HOME/.nvm'
$PATH: /home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$HOME/.sdkman/candidates/kotlin/current/bin:$HOME/.cargo/bin:$HOME/go/bin:$HOME/.deno/bin:$HOME/flutter/bin:/usr/lib/dart/bin:/usr/local/go/bin:$HOME/.pub-cache/bin:$HOME/Android/Sdk/tools/bin:$HOME/Android/Sdk/emulator:$HOME/Android/Sdk/tools:$HOME/.cargo/bin:$HOME/go/bin:$HOME/.deno/bin:$HOME/flutter/bin:/usr/lib/dart/bin:/usr/local/go/bin:$HOME/.pub-cache/bin:$HOME/Android/Sdk/tools/bin:$HOME/Android/Sdk/emulator:$HOME/Android/Sdk/tools:$NVM_DIR/versions/node/v10.15.3/bin:$HOME/.cargo/bin:/usr/local/go/bin:$HOME/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:$HOME/.fzf/bin
$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 5.4.23-050423-lowlatency #202002281329 SMP PREEMPT Fri Feb 28 18:39:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux'
OS version: Linux Mint 19.3 Tricia
curl: /usr/bin/curl, curl 7.58.0 (x86_64-pc-linux-gnu) libcurl/7.58.0 OpenSSL/1.1.1 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,.idea,.tox} (grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox}), 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.3
which node: $NVM_DIR/versions/node/v10.15.3/bin/node
which iojs: iojs not found
which npm: $NVM_DIR/versions/node/v10.15.3/bin/npm
npm config get prefix: $NVM_DIR/versions/node/v10.15.3
npm root -g: $NVM_DIR/versions/node/v10.15.3/lib/node_modules

nvm ls output:

```sh v6.11.3 -> v10.15.3 v10.19.0 v11.15.0 v12.19.0 system default -> v10.15.3 node -> stable (-> v12.19.0) (default) stable -> 12.19 (-> v12.19.0) (default) iojs -> N/A (default) unstable -> N/A (default) lts/* -> lts/erbium (-> v12.19.0) lts/argon -> v4.9.1 (-> N/A) lts/boron -> v6.17.1 (-> N/A) lts/carbon -> v8.17.0 (-> N/A) lts/dubnium -> v10.22.1 (-> N/A) lts/erbium -> v12.19.0 ```

How did you install nvm?

What steps did you perform?

nvm install v12.19.0 --reinstall-packages-from=v10.15.3

What happened?

it exited totally after failling to install one package - tstags

I installed tstags from git, so it's normal that npm cannot find it. But nvm should give a list with succeed packages and failed packages instead of failling all...

What did you expect to happen?

Is there anything in any of your profile files that modifies the PATH?

If you are having installation issues, or getting "N/A", what does curl -I --compressed -v https://nodejs.org/dist/ print out?

```sh ```
ljharb commented 3 years ago

After that fails, I'd expect the actual nvm install to have succeeded, but the overarching command would exit nonzero because the package reinstallation failed. I'd also expect every package alphabetically before the failed one would successfully install. Is that the case?

GopherJ commented 3 years ago

@ljharb Yes I would like to see a list with succeed/failed packages so that I can manage those failed packages

ljharb commented 3 years ago

The reinstalled global packages are all installed as one npm install command, both for speed and for simplicity of the code. Can you share the exact output you got?

GopherJ commented 3 years ago
➜  tunnel git:(main) ✗ nvm install v12.19.0 --reinstall-packages-from=v10.15.3
v12.19.0 is already installed.
Now using node v12.19.0 (npm v6.14.8)
VERSION=''
Reinstalling global packages from v10.15.3...
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/tstags - Not found
npm ERR! 404
npm ERR! 404  'tstags@0.1.0' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/cheng/.npm/_logs/2020-10-22T08_24_23_963Z-debug.log
Linking global packages from v10.15.3...
No linked global packages found...
➜  tunnel git:(main) ✗

hi @ljharb here the logs, tstags is installed using git url, so it's normal that npm cannot find it

ljharb commented 3 years ago

Thanks. Looking at this tho, it's still proceeding to re-link global packages - I assume that echo $? at this point prints out 0?

GopherJ commented 3 years ago

@ljharb yes it's 0