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

help output is misleading re nvm install argument order #2301

Closed
62f opened this issue Sep 11, 2020 · 11 comments
Closed

help output is misleading re nvm install argument order #2301

62f opened this issue Sep 11, 2020 · 11 comments
Labels
informational pull request wanted This is a great way to contribute! Help us out :-D

Comments

@62f
Copy link

62f commented Sep 11, 2020

I'm not familiar with "ash" as a shell, what is k? @62f can you file a new issue?

Originally posted by @ljharb in #1950 (comment)

bash-5.0# nvm install 14.10.0 --latest-npm
Downloading and installing node v14.10.0...
Downloading https://nodejs.org/dist/v14.10.0/node-v14.10.0-linux-x86.tar.xz...
curl: (22) The requested URL returned error: 404                                     

Binary download from https://nodejs.org/dist/v14.10.0/node-v14.10.0-linux-x86.tar.xz failed, trying source.
grep: /root/.nvm/.cache/bin/node-v14.10.0-linux-x86/node-v14.10.0-linux-x86.tar.xz: No such file or directory
Provided file to checksum does not exist.
Binary download failed, trying source.
Additional options while compiling:  --latest-npm
Local cache found: $NVM_DIR/.cache/src/node-v14.10.0/node-v14.10.0.tar.xz
Checksums match! Using existing downloaded archive $NVM_DIR/.cache/src/node-v14.10.0/node-v14.10.0.tar.xz
$>./configure --prefix=/root/.nvm/versions/node/v14.10.0 --latest-npm<
Node.js configure: Found Python 2.7.18...
Usage: configure [options]

configure: error: no such option: --latest-npm
nvm: install v14.10.0 failed!
bash-5.0# nvm --version
0.34.0
bash-5.0# nvm debug
nvm --version: v0.34.0
$SHELL: /bin/ash
$SHLVL: 12
$HOME: /root
$NVM_DIR: '$HOME/.nvm'
$PATH: $NVM_DIR/versions/node/v9.11.2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin
$PREFIX: ''
$NPM_CONFIG_PREFIX: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
<Bash-5.0 unexpectedly gives up at this point and exits to without any prefix/prompt to ash, the standard cl shell for Alpine 3.12, a bug which is not being considered as part of this issue; I typed ‘k’ only as a test to determine the response>
@ljharb
Copy link
Member

ljharb commented Sep 11, 2020

This is all quite confusing.

The initial 404 is confusing since https://nodejs.org/dist/v14.10.0/node-v14.10.0-linux-x86.tar.xz exists.

Additionally, configure: error: no such option: --latest-npm is confusing since --latest-npm should be shifted before being passed to configure.

What is ash? Have you tried on bash 4, or only on bash 5?

@ljharb ljharb added the needs followup We need some info or action from whoever filed this issue/PR. label Sep 11, 2020
@62f
Copy link
Author

62f commented Sep 11, 2020

I only have one option for a Bash binary in Alpine. At boot I load zsh, but the zsh they build for Alpine is not Bourne-compatible.
https://nodejs.org/dist/v14.10.0
No, node-v14.10.0-linux-x86.tar.xz does not exist, but that is not the problem. The problem is that configure does not recognize an option which is clearly documented directly in its own —help.

@62f
Copy link
Author

62f commented Sep 11, 2020

Just typed ‘export $PATH’ into the rogue ash/AWOL bash, because the environment variables were missing, and what I suppose was supposed to follow my “k” spontaneously got coughed up, and Bash resurrected itself, probably not related to the issue, but here’s the rest of that diagnostic info, I think.

export $PATH
/bin/ash: export: line 4: /root/.nvm/versions/node/v9.11.2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin: bad variable name
'hell version: 'HTTP/2 200 
uname -a: 'Linux 4.20.69-ish iSH 1.0 (74) Aug 17 2020 23:29:03 i686 Linux'
OS version: Welcome to Alpine Linux 3.12
curl: /usr/bin/curl, curl 7.69.1 (i586-alpine-linux-musl) libcurl/7.69.1 OpenSSL/1.1.1g zlib/1.2.11 nghttp2/1.41.0
wget: /usr/bin/wget, GNU Wget 1.20.3 built on linux-musl.
git: /usr/bin/git, git version 2.26.2
grep: unrecognized option: version
BusyBox v1.31.1 () multi-call binary.

Usage: grep [-HhnlLoqvsriwFE] [-m N] [-A/B/C N] PATTERN/-e PATTERN.../-f FILE [FILE]...

Search for PATTERN in FILEs (or stdin)

        -H      Add 'filename:' prefix
        -h      Do not add 'filename:' prefix
        -n      Add 'line_no:' prefix
        -l      Show only names of files that match
        -L      Show only names of files that don't match
        -c      Show only count of matching lines
        -o      Show only the matching part of line
        -q      Quiet. Return 0 if PATTERN is found, 1 otherwise
        -v      Select non-matching lines
        -s      Suppress open and read errors
        -r      Recurse
        -i      Ignore case
        -w      Match whole words only
        -x      Match whole lines only
        -F      PATTERN is a literal (not regexp)
        -E      PATTERN is an extended regexp
        -m N    Match up to N times per file
        -A N    Print N lines of trailing context
        -B N    Print N lines of leading context
        -C N    Same as '-A N -B N'
        -e PTRN Pattern to match
        -f FILE Read pattern from file
grep: /bin/grep, 
awk: /usr/bin/awk, GNU Awk 5.1.0, API: 3.0
sed: /bin/sed, This is not GNU sed version 4.0
cut: unrecognized option: version
BusyBox v1.31.1 () multi-call binary.

Usage: cut [OPTIONS] [FILE]...

Print selected fields from each input FILE to stdout

        -b LIST Output only bytes from LIST
        -c LIST Output only characters from LIST
        -d CHAR Use CHAR instead of tab as the field delimiter
        -s      Output only the lines containing delimiter
        -f N    Print only these fields
        -n      Ignored
cut: /usr/bin/cut, 
basename: /usr/bin/basename, --version
rm: unrecognized option: version
BusyBox v1.31.1 () multi-call binary.

Usage: rm [-irf] FILE...

Remove (unlink) FILEs

        -i      Always prompt before removing
        -f      Never prompt
        -R,-r   Recurse
rm: /bin/rm, 
mkdir: unrecognized option: version
BusyBox v1.31.1 () multi-call binary.

Usage: mkdir [OPTIONS] DIRECTORY...

Create DIRECTORY

        -m MODE Mode
        -p      No error if exists; make parent directories as needed
mkdir: /bin/mkdir, 
xargs: unrecognized option: version
BusyBox v1.31.1 () multi-call binary.

Usage: xargs [OPTIONS] [PROG ARGS]

Run PROG on every item given by stdin

        -0      Input is separated by NULs
        -a FILE Read from FILE instead of stdin
        -r      Don't run command if input is empty
        -t      Print the command on stderr before execution
        -p      Ask user whether to run each command
        -E STR,-e[STR]  STR stops input processing
        -I STR  Replace STR within PROG ARGS with input line
        -n N    Pass no more than N args to PROG
        -s N    Pass command line of no more than N bytes
        -P N    Run up to N PROGs in parallel
        -x      Exit if size is exceeded
xargs: /usr/bin/xargs, 
nvm current: 
which node: $NVM_DIR/versions/node/v9.11.2/bin/node
which iojs: 
which npm: 
npm config get prefix: bash: npm: command not found
npm root -g: bash: npm: command not found

@ljharb
Copy link
Member

ljharb commented Sep 11, 2020

There's a lot of errors happening that shouldn't be - it's possible ash isn't POSIX-compliant. grep --version and xargs --version and a number of others don't seem to work.

Also, you want export PATH, not export $PATH (which tries to export the contents of the variable as the env var name).

@62f
Copy link
Author

62f commented Sep 11, 2020

You’re being distracted by the scientific wizardry which I use for sanity checks. Science.
I simply postulated that my CLI appeared to be hung and proved myself correct by entering a letter (k) as a diagnostic. Likewise when odd things are happening, I sometimes issue a bad command (export $PATH) as ‘electroshock-therapy’, and that’s when the experiment caused ash to simply be materialized out of nowhere- it was just quietly sitting there already, but without the usual salutary-prompt. Ash didn’t have anything to do with the unrecognized options in grep or xargs because those binaries are called from within BusyBox v1.31.1 () multi-call binary, not ash, bash, nor zsh, and even so, Bash 5.0 was presumably still running underneath Busybox.
However I would be amazed to be told that this were not at all true: or that bash is just a dumb wrapper for ash, or that Busybox binaries are really supposed to inherit specific Posix ‘extra-functionality boost’ in Bash/zsh/foo versus -ash.

@ljharb
Copy link
Member

ljharb commented Sep 12, 2020

I'm going to have to beg ignorance here. I'm not at all familiar with BusyBox, or ash, or even Bash 5.0.

However, testing locally, nvm install 14.10.0 --latest-npm does indeed pass --latest-npm to the node install process, while nvm install --latest-npm 14.10.0 works fine. I think this is just a legacy limitation of nvm install - namely, that all "install" options have to appear before the version number, since everything after the version number is treated as an additional installation configuration parameter.

@62f
Copy link
Author

62f commented Sep 13, 2020

Legacy limitation, ergo I’ve got ahold of an old copy of nvm.
nvm install -s --latest-npm 14.10.0
appears to work fine, and soon as it finishes I’ll take out the -s, because my impression was that the error was mishandling of the —latest-npm parameter after being unexpectedly failed over to build from source.

‘Last stand perk activated’

@ljharb
Copy link
Member

ljharb commented Sep 13, 2020

I don’t mean you have an old nvm, i mean that “the original way nvm install was implemented” constrains all future versions of nvm.

@62f
Copy link
Author

62f commented Sep 13, 2020

Bash-5.0# nvm install --latest-npm 14.10.0
Also appears to work without complaint, so this whole issue is being caused by the way the offline help is written: To me it reads as requiring the version number to appear before the —parameters, when parameters are added. It’s not penultimately crystal-clear to me that the version number needs always to appear last. In fact, the functional order describes the opposite. Needs badly to be rewritten.
bash-5.0# nvm --version
0.34.0
C8DC076C-D295-4727-B599-4FB3F9D07BBE

@62f
Copy link
Author

62f commented Sep 13, 2020

trying to do npm uninstall npm -g and then nvm install v9.9.0 --latest-npm

Originally posted by @talbarda in npm/npm#20234 (comment)

@ljharb
Copy link
Member

ljharb commented Sep 13, 2020

That's a fair point; i'll look into improving the help output there.

@ljharb ljharb added informational pull request wanted This is a great way to contribute! Help us out :-D and removed needs followup We need some info or action from whoever filed this issue/PR. labels Sep 13, 2020
@ljharb ljharb changed the title configure: error: no such option: --latest-npm help output is misleading re nvm install argument order Sep 13, 2020
@ljharb ljharb closed this as completed in 7929190 Oct 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
informational pull request wanted This is a great way to contribute! Help us out :-D
Projects
None yet
Development

No branches or pull requests

2 participants