Skip to content

Adding an extra slash to --latest-npm gives an unclear error #1915

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

Closed
ferrybig opened this issue Sep 26, 2018 · 2 comments
Closed

Adding an extra slash to --latest-npm gives an unclear error #1915

ferrybig opened this issue Sep 26, 2018 · 2 comments
Labels
bugs Oh no, something's broken :-(

Comments

@ferrybig
Copy link

  • Operating system and version:

  • nvm debug output:

nvm --version: v0.33.11
$SHELL: /bin/bash
$SHLVL: 2
$HOME: /home/fernando
$NVM_DIR: '$HOME/.nvm'
$PATH: $NVM_DIR/versions/node/v10.11.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
$PREFIX: ''
$NPM_CONFIG_PREFIX: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'GNU bash, version 4.4.19(1)-release (x86_64-pc-linux-gnu)'
uname -a: 'Linux 4.15.0-34-generic #37-Ubuntu SMP Mon Aug 27 15:21:48 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: /bin/grep (grep --color=auto), grep (GNU grep) 3.1
sed: -e expression #1, char 9: Unmatched ) or \)
awk: not an option: --version
awk: , 
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.11.0
which node: $NVM_DIR/versions/node/v10.11.0/bin/node
which iojs: 
which npm: $NVM_DIR/versions/node/v10.11.0/bin/npm
npm config get prefix: $NVM_DIR/versions/node/v10.11.0
npm root -g: $NVM_DIR/versions/node/v10.11.0/lib/node_modules
  • nvm ls output:
$ nvm ls
->     v10.11.0
         system
node -> stable (-> v10.11.0) (default)
stable -> 10.11 (-> v10.11.0) (default)
iojs -> N/A (default)
lts/* -> lts/carbon (-> N/A)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.14.4 (-> N/A)
lts/carbon -> v8.12.0 (-> N/A)
  • How did you install nvm? (e.g. install script in readme, Homebrew):
    script in readme: curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash

  • What steps did you perform?
    Ran accedentially nvm install ---latest-npm when trying to install the latest node version

  • What happened?
    It gave weird & unclear errors:

grep: unrecognized option '---latest-npm'
Usage: grep [OPTION]... PATTERN [FILE]...
Try 'grep --help' for more information.
grep: unrecognized option '---latest-npm'
Usage: grep [OPTION]... PATTERN [FILE]...
Try 'grep --help' for more information.
Version '---latest-npm' not found - try `nvm ls-remote` to browse available versions.

  • What did you expect to happen?

It should have given me a clear warning that I passed an unknown command flag to nvm, and not to grep

  • Is there anything in any of your profile files (.bashrc, .bash_profile, .zshrc, etc) that modifies the PATH?
    I use the latest Ubuntu LTS version, and that one doesn't modify the path
@ljharb
Copy link
Member

ljharb commented Sep 26, 2018

This is an interesting one. I'd expect here to send the arg to here where it's passed into here and so forth. I'll have to look into this.

@ljharb ljharb added the bugs Oh no, something's broken :-( label Sep 26, 2018
@ljharb
Copy link
Member

ljharb commented Nov 9, 2018

Considering that all unknown options to nvm install are assumed to be additional parameters passed to a source install, I'm not sure any error can be given here. The "fix" would be to make it not error at all.

ljharb added a commit to ljharb/nvm that referenced this issue Feb 25, 2019
@ljharb ljharb closed this as completed in 226487d Feb 25, 2019
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 :-(
Projects
None yet
Development

No branches or pull requests

2 participants