MacOS 10.13.3
nvm debug output:nvm --version: v0.33.8
$TERM_PROGRAM: iTerm.app
$SHELL: /usr/local/bin/bash
$HOME: /Users/joeptacek
$NVM_DIR: '$HOME/.nvm'
$PREFIX: ''
$NPM_CONFIG_PREFIX: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'GNU bash, version 4.4.19(1)-release (x86_64-apple-darwin17.3.0)'
uname -a: 'Darwin 17.4.0 Darwin Kernel Version 17.4.0: Sun Dec 17 09:19:54 PST 2017; root:xnu-4570.41.2~1/RELEASE_X86_64 x86_64'
OS version: Mac 10.13.3 17D102
curl: /usr/bin/curl, curl 7.54.0 (x86_64-apple-darwin17.0) libcurl/7.54.0 LibreSSL/2.0.20 zlib/1.2.11 nghttp2/1.24.0
wget: not found
git: /usr/local/bin/git, git version 2.16.2
grep: /usr/bin/grep, grep (BSD grep) 2.5.1-FreeBSD
awk: /usr/bin/awk, awk version 20070501
sed: illegal option -- -
usage: sed script [-Ealn] [-i extension] [file ...]
sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]
sed: /usr/bin/sed,
cut: illegal option -- -
usage: cut -b list [-n] [file ...]
cut -c list [file ...]
cut -f list [-s] [-d delim] [file ...]
cut: /usr/bin/cut,
basename: illegal option -- -
usage: basename string [suffix]
basename [-a] [-s suffix] string [...]
basename: /usr/bin/basename,
rm: illegal option -- -
usage: rm [-f | -i] [-dPRrvW] file ...
unlink file
rm: /bin/rm,
mkdir: illegal option -- -
usage: mkdir [-pv] [-m mode] directory ...
mkdir: /bin/mkdir,
xargs: illegal option -- -
usage: xargs [-0opt] [-E eofstr] [-I replstr [-R replacements]] [-J replstr]
[-L number] [-n number [-x]] [-P maxprocs] [-s size]
[utility [argument ...]]
xargs: /usr/bin/xargs,
nvm current: v8.10.0
which node: $NVM_DIR/versions/node/v8.10.0/bin/node
which iojs:
which npm: $NVM_DIR/versions/node/v8.10.0/bin/npm
npm config get prefix: $NVM_DIR/versions/node/v8.10.0
npm root -g: $NVM_DIR/versions/node/v8.10.0/lib/node_modules
nvm ls output: v8.9.3
-> v8.10.0
default -> node (-> v8.10.0)
node -> stable (-> v8.10.0) (default)
stable -> 8.10 (-> v8.10.0) (default)
iojs -> N/A (default)
lts/* -> lts/carbon (-> v8.10.0)
lts/argon -> v4.8.7 (-> N/A)
lts/boron -> v6.13.1 (-> N/A)
lts/carbon -> v8.10.0
nvm? (e.g. install script in readme, Homebrew):Install via git
Tried to install latest LTS, reinstalling global packages from previous latest LTS (not sure if nvm would resolve previous latest correctly)
nvm install --lts --reinstall-packages-from='lts/*'
Also tried more explicitly
nvm install --lts --reinstall-packages-from=8.9.3
In each case, was informed either
grep: unrecognized option `--reinstall-packages-from=lts/*'
usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [--binary-files=value] [--color=when]
[--context[=num]] [--directories=action] [--label] [--line-buffered]
[--null] [pattern] [file ...]
Version '--reinstall-packages-from=lts/*' (with LTS filter) not found - try `nvm ls-remote --lts` to browse available versions.
or
grep: unrecognized option `--reinstall-packages-from=8.9.3'
usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [--binary-files=value] [--color=when]
[--context[=num]] [--directories=action] [--label] [--line-buffered]
[--null] [pattern] [file ...]
Version '--reinstall-packages-from=8.9.3' (with LTS filter) not found - try `nvm ls-remote --lts` to browse available versions.
At any rate this works fine
nvm install --lts
nvm reinstall-packages 8.9.3
I was hoping to install the latest LTS and reinstall global packages from my old LTS. I think I've done something similar in the past without issue. Am I misusing the --reinstall-packages-from= option?
.bashrc, .bash_profile, .zshrc, etc) that modifies the PATH?# in .bashrc, sourced from .bash_profile
export PATH="/usr/local/bin:$PATH"
export PATH="$HOME/bin:$PATH"
Both options you tried should indeed work. Just to confirm: just last night I pushed a change to master that alters this option a bit; you said "install via git" - does that means you're using the latest master?
If you try one commit back (or, the latest release tag), does it work?
I'm at the last release tag (v0.33.8), not the latest master. I just tried removing $NVM_DIR and cloning fresh from v0.33.8, still the same issue when I install 8.9.3 / global packages, then try to install a more recent LTS using the --reinstall-packages-from=8.9.3 option. Maybe something else in my environment is weird? I'll try on another device.
Same issue on another Mac, with essentially the same nvm debug output (only diffs on "uname -a" and "OS version" lines for other Mac running 10.13.2). Same commit (v0.33.8). There's another, slightly fresher Mac I can test on a bit later.
@joeptacek thanks for the followup. It's possible that there's a bug in reinstall-packages-from with LTS aliases.
One thing to note, however: the instant you do nvm ls-remote (which nvm install does, implicitly) - you'll get an updated list of LTS versions, and 8.9.3 isn't the latest LTS anymore once 8.9.4 came out. So, I think the logic here might only work if your lts/* alias points at 8.9.3 prior to the nvm install command?
Separately, nvm install --lts --reinstall-packages-from=blah might be incorrectly applying --lts to "blah", which is easier to fix.
Makes sense, re: lts/* not targeting the _previous_ LTS; would be nifty if it resolved that way but was not necessarily expecting that behavior
FWIW just tested this, and works fine (using 8.9.4 instead of --lts to specify install version):
nvm install 8.9.4 --reinstall-packages-from=8.9.3
As you say, it seems that the --lts filter is what's making things buggy here
FWIW, in the meantime, you can just do a two-command operation to get around the bug:
> nvm install --lts
> nvm install [version that install] --reinstall-packages-from=[previous version]
Maybe that's obvious to everyone but me...
Still an issue. Will this ever be resolved? (I realize it's a minor thing and the workaround above is fine)
I use an initial nvm alias dubnium $(nvm current) to store my latest installed node10 version and added a .bashrc alias for upgrading to LTS / purging the previous node version.
May not be the prettiest thing in the world, but it does the job 👍.
nvm use dubnium && oldNode=$(nvm current) && nvm install --lts=dubnium && nvm install $(nvm current) --reinstall-packages-from=${oldNode} && nvm alias dubnium $(nvm current) && nvm uninstall ${oldNode}
@impulse I'd expect nvm install lts/dubnium --reinstall-packages-from=lts/dubnium to work in the meantime.
@ljharb I don't understand the --reinstall-packages-from=lts/dubnium part. Wouldn't that point to the latest available dubnium release but not to the latest locally installed one?
@impulse ahhh right, that's the whole point of this issue. Never mind my comment.
Any news on this? nvm install --lts --reinstall-packages-from=x.y.z still throws
Most helpful comment
FWIW, in the meantime, you can just do a two-command operation to get around the bug:
Maybe that's obvious to everyone but me...