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

--reinstall-packages-from= option unrecognized when doing nvm install --lts #1762

Closed
joeptacek opened this issue Mar 14, 2018 · 12 comments
Closed
Labels
bugs Oh no, something's broken :-( installing node Issues with installing node/io.js versions.

Comments

@joeptacek
Copy link

  • Operating system and version:

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
  • How did you install nvm? (e.g. install script in readme, Homebrew):

Install via git

  • What steps did you perform?

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
  • What happened?

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
  • What did you expect to happen?

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?

  • Is there anything in any of your profile files (.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"
@ljharb
Copy link
Member

ljharb commented Mar 14, 2018

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?

@joeptacek
Copy link
Author

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.

@joeptacek
Copy link
Author

joeptacek commented Mar 15, 2018

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.

@ljharb
Copy link
Member

ljharb commented Mar 20, 2018

@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.

@ljharb ljharb added installing node Issues with installing node/io.js versions. bugs Oh no, something's broken :-( labels Mar 20, 2018
@joeptacek
Copy link
Author

joeptacek commented Mar 20, 2018

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

@gonzofish
Copy link

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...

@ffxsam
Copy link

ffxsam commented Jun 6, 2019

Still an issue. Will this ever be resolved? (I realize it's a minor thing and the workaround above is fine)

@ecklf
Copy link

ecklf commented Aug 8, 2019

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}

@ljharb

This comment has been minimized.

@ecklf

This comment has been minimized.

@ljharb

This comment has been minimized.

@toastyghost
Copy link

Any news on this? nvm install --lts --reinstall-packages-from=x.y.z still throws

@ljharb ljharb closed this as completed in 6575b6b Jun 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugs Oh no, something's broken :-( installing node Issues with installing node/io.js versions.
Projects
None yet
Development

No branches or pull requests

6 participants