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

nvm install node will not find/install the binaries on linux running in ChromeOS containier. #2923

Open
jordyjwilliams opened this issue Oct 22, 2022 · 17 comments

Comments

@jordyjwilliams
Copy link

Operating system and version:

ChromeOS --> Running container of Linux.

nvm_get_os                                                                                            ─╯
linux
nvm_get_arch
x64

nvm debug output:

nvm --version: v0.39.2
$SHELL: /usr/bin/zsh
$SHLVL: 1
whoami: 'jordyjwilliams'
${HOME}: /home/jordyjwilliams
${NVM_DIR}: '${HOME}/.config/nvm'
${PATH}: ${HOME}/gems/bin:${HOME}/gems/bin:${HOME}/gems/bin:${HOME}/gems/bin:${HOME}/gems/bin:${HOME}/gems/bin:${HOME}/miniconda3/bin:${HOME}/miniconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/local/games:/usr/sbin:/usr/bin:/usr/games:/sbin:/bin:${HOME}/.cargo/bin/navi:${HOME}/.cargo/bin/navi:${HOME}/.cargo/bin/navi:${HOME}/.cargo/bin/navi:${HOME}/.cargo/bin/navi:${HOME}/.cargo/bin/navi
$PREFIX: ''
${NPM_CONFIG_PREFIX}: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'zsh 5.8 (x86_64-debian-linux-gnu)'
uname -a: 'Linux 5.10.136-19394-g7a24dee39fa0 #1 SMP PREEMPT Wed Oct 12 18:52:22 PDT 2022 x86_64 GNU/Linux'
checksum binary: 'sha256sum'
OS version: Debian GNU/Linux 11  
curl: /usr/bin/curl, curl 7.74.0 (x86_64-pc-linux-gnu) libcurl/7.74.0 OpenSSL/1.1.1n zlib/1.2.11 brotli/1.0.9 libidn2/2.3.0 libpsl/0.21.0 (+libidn2/2.3.0) libssh2/1.9.0 nghttp2/1.43.0 librtmp/2.3
wget: /usr/bin/wget, GNU Wget 1.21 built on linux-gnu.
git: /usr/bin/git, git version 2.30.2
ls: cannot access 'grep:': No such file or directory
grep: grep: aliased to grep --color (grep --color), grep (GNU grep) 3.6
awk: /usr/bin/awk, awk: not an option: --version
sed: /usr/bin/sed, sed (GNU sed) 4.7
cut: /usr/bin/cut, cut (GNU coreutils) 8.32
basename: /usr/bin/basename, basename (GNU coreutils) 8.32
ls: cannot access 'rm:': No such file or directory
rm: rm: aliased to rm -i (rm -i), rm (GNU coreutils) 8.32
mkdir: /usr/bin/mkdir, mkdir (GNU coreutils) 8.32
xargs: /usr/bin/xargs, xargs (GNU findutils) 4.8.0
nvm current: system
which node: /usr/local/bin/node
which iojs: iojs not found
which npm: /usr/local/bin/npm
npm config get prefix: /usr/local
npm root -g: /usr/local/lib/node_modules

nvm ls output:

->       system
iojs -> N/A (default)
node -> stable (-> N/A) (default)
unstable -> N/A (default)
lts/* -> lts/gallium (-> N/A)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.24.1 (-> N/A)
lts/erbium -> v12.22.12 (-> N/A)
lts/fermium -> v14.20.1 (-> N/A)
lts/gallium -> v16.18.0 (-> N/A)

How did you install nvm?

Install script in readme

What steps did you perform?

  • Install nvm as per instructions in README
  • Validate nvm working as expected
  • nvm install node and nvm install --lts

What happened?

Downloading and installing node v19.0.0...
Downloading https://nodejs.org/dist/v19.0.0/.tar.xz...
curl: (22) The requested URL returned error: 404                                                            

Binary download from https://nodejs.org/dist/v19.0.0/.tar.xz failed, trying source.
grep: /home/jordyjwilliams/.config/nvm/.cache/bin//.tar.xz: No such file or directory
Provided file to checksum does not exist.
Binary download failed, trying source.
Local cache found: ${NVM_DIR}/.cache/src/node-v19.0.0/node-v19.0.0.tar.xz
Computing checksum with sha256sum
Checksums do not match: 'f24a3d527ba89312e3f6c5d720414b304525c24ff8631058ec96d28e6b24991e' found, '0b72d207a5815f1ce7b247b33cbf9a2c86f6d01253fa3990c9744e25d975050d' expected.
Checksum check failed!
Removing the broken local cache...
Downloading https://nodejs.org/dist/v19.0.0/node-v19.0.0.tar.xz...
#                                                                                                        1.6%

What did you expect to happen?

  • can correctly identify and download node binaries
  • Do not need to build from source

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

miniconda
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/jordyjwilliams/miniconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/home/jordyjwilliams/miniconda3/etc/profile.d/conda.sh" ]; then
        . "/home/jordyjwilliams/miniconda3/etc/profile.d/conda.sh"
    else
        export PATH="/home/jordyjwilliams/miniconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<
Gems
export GEM_HOME="$HOME/gems"
export PATH="$HOME/gems/bin:$PATH"

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

*   Trying 104.20.22.46:443...
* Connected to nodejs.org (104.20.22.46) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*  CAfile: /etc/ssl/certs/ca-certificates.crt
*  CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN, server accepted to use h2
* Server certificate:
*  subject: CN=*.nodejs.org
*  start date: Jan 11 00:00:00 2022 GMT
*  expire date: Feb 11 23:59:59 2023 GMT
*  subjectAltName: host "nodejs.org" matched cert's "nodejs.org"
*  issuer: C=GB; ST=Greater Manchester; L=Salford; O=Sectigo Limited; CN=Sectigo RSA Domain Validation Secure Server CA
*  SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x57da984992c0)
> HEAD /dist/ HTTP/2
> Host: nodejs.org
> user-agent: curl/7.74.0
> accept: */*
> accept-encoding: deflate, gzip, br
> 
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
* Connection state changed (MAX_CONCURRENT_STREAMS == 256)!
< HTTP/2 200 
HTTP/2 200 
< date: Sat, 22 Oct 2022 02:27:02 GMT
date: Sat, 22 Oct 2022 02:27:02 GMT
< content-type: text/html
content-type: text/html
< last-modified: Sat, 22 Oct 2022 01:05:20 GMT
last-modified: Sat, 22 Oct 2022 01:05:20 GMT
< cache-control: max-age=14400
cache-control: max-age=14400
< cf-cache-status: HIT
cf-cache-status: HIT
< age: 808
age: 808
< vary: Accept-Encoding
vary: Accept-Encoding
< strict-transport-security: max-age=31536000; includeSubDomains; preload
strict-transport-security: max-age=31536000; includeSubDomains; preload
< x-content-type-options: nosniff
x-content-type-options: nosniff
< server: cloudflare
server: cloudflare
< cf-ray: 75decaa59e743775-MEL
cf-ray: 75decaa59e743775-MEL
< content-encoding: br
content-encoding: br

< 
* Connection #0 to host nodejs.org left intact

Any help would be much appreciated. Not sure if it's anything with my python envs (conda) setup here,.

Thanks!

@jordyjwilliams
Copy link
Author

Ahhh Sorry! This does seem to duplicate a few issues.

Tried running this through bash not zsh and was able to install as expected.

I figured it was something in my PATH or grep that was causing the arch/os versions to not be set correctly...

─❯ nvm install -b node                                                                                                                                                                                                                         ─╯
Downloading and installing node v19.0.0...
Downloading https://nodejs.org/dist/v19.0.0/.tar.xz...   # Incorrectly set here...
curl: (22) The requested URL returned error: 404                                                                                                                                                                                                  

Binary download from https://nodejs.org/dist/v19.0.0/.tar.xz failed, trying source.
grep: /home/jordyjwilliams/.config/nvm/.cache/bin//.tar.xz: No such file or directory

To fix this to enable zsh shell use for nvm I was able to add the nvm plugin into the .zshrc...

@jordyjwilliams
Copy link
Author

Not sure if there are any similar issues to this or how it came about so will leave open in the case someone can better explaini to me....

AFAIK the only things I had modifying my root were miniconda3 and standard oh-my-zsh setup...

Is there someway to make the output clearer here... As in perhaps a check for the path.

@gargolito
Copy link

I am experiencing this on kubuntu 22.04.1 LTS with nvm. Seems to be issue with how it is using curl - the tarball is not being downloaded. I used a workaround by modifying line 120 to force using wget. I changed the line from:
if nvm_has "curl"; then
to
if ! nvm_has "curl"; then

nvm debug output (Without workaround)

$SHELL: /bin/bash
$SHLVL: 1
whoami: 'gargolito'
${HOME}: /home/gargolito
${NVM_DIR}: '${HOME}/.nvm'
${PATH}: ${NVM_DIR}/versions/node/v16.18.0/bin:${HOME}/.pyenv/shims:${HOME}/.pyenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${HOME}/scripts:${HOME}/bin:${HOME}/build/flutter/bin:${HOME}/build/android-studio/bin:${HOME}/go/bin:/snap/bin
$PREFIX: ''
${NPM_CONFIG_PREFIX}: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)'
uname -a: 'Linux 5.15.0-50-generic #56-Ubuntu SMP Tue Sep 20 13:23:26 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux'
checksum binary: 'sha256sum'
OS version: Ubuntu 22.04.1 LTS  
curl: /usr/bin/curl (curl -s -k -A $UA), curl 7.81.0 (x86_64-pc-linux-gnu) libcurl/7.81.0 OpenSSL/3.0.2 zlib/1.2.11 brotli/1.0.9 zstd/1.4.8 libidn2/2.3.2 libpsl/0.21.0 (+libidn2/2.3.2) libssh/0.9.6/openssl/zlib nghttp2/1.43.0 librtmp/2.3 OpenLDAP/2.5.13
wget: /usr/bin/wget (wget --no-check-certificate), GNU Wget 1.21.2 built on linux-gnu.
git: /usr/bin/git, git version 2.34.1
grep: /usr/bin/grep, grep (GNU grep) 3.7
awk: /usr/bin/awk, GNU Awk 5.1.0, API: 3.0 (GNU MPFR 4.1.0, GNU MP 6.2.1)
sed: /usr/bin/sed, sed (GNU sed) 4.8
cut: /usr/bin/cut, cut (GNU coreutils) 8.32
basename: /usr/bin/basename, basename (GNU coreutils) 8.32
rm: /usr/bin/rm, rm (GNU coreutils) 8.32
mkdir: /usr/bin/mkdir, mkdir (GNU coreutils) 8.32
xargs: /usr/bin/xargs (xargs -L 1), xargs (GNU findutils) 4.8.0
nvm current: v16.18.0
which node: ${NVM_DIR}/versions/node/v16.18.0/bin/node
which iojs: 
which npm: ${NVM_DIR}/versions/node/v16.18.0/bin/npm
npm config get prefix: ${NVM_DIR}/versions/node/v16.18.0
npm root -g: ${NVM_DIR}/versions/node/v16.18.0/lib/node_modules

@jordyjwilliams
Copy link
Author

Yeah @gargolito did you try using bash or another shell and did it work okay for you.

I was able to fix this for myself by editing my settings in my .zshrc and bashrc... I think miniconda and other things modifying my PATH may have been causing issues...

I think likely some issue with setting the shell version.... As can be seen in my reply below I did not get the OS version set correctly before these changes. Keeping the issue open for now as I think at least a few others had reported similar behaviour on various linux distros.

Ahhh Sorry! This does seem to duplicate a few issues.

Tried running this through bash not zsh and was able to install as expected.

I figured it was something in my PATH or grep that was causing the arch/os versions to not be set correctly...

─❯ nvm install -b node                                                                                                                                                                                                                         ─╯
Downloading and installing node v19.0.0...
Downloading https://nodejs.org/dist/v19.0.0/.tar.xz...   # Incorrectly set here...
curl: (22) The requested URL returned error: 404                                                                                                                                                                                                  

Binary download from https://nodejs.org/dist/v19.0.0/.tar.xz failed, trying source.
grep: /home/jordyjwilliams/.config/nvm/.cache/bin//.tar.xz: No such file or directory

To fix this to enable zsh shell use for nvm I was able to add the nvm plugin into the .zshrc...

@jordyjwilliams
Copy link
Author

@gargolito did yours attempt the download at all then try to compile from source? did you get a 404 error too?

@ljharb
Copy link
Member

ljharb commented Oct 24, 2022

@gargolito (curl -s -k -A $UA) in your nvm debug output is suspicious; mine doesn't have that.

@gargolito
Copy link

gargolito commented Oct 24, 2022 via email

@ljharb
Copy link
Member

ljharb commented Oct 24, 2022

@gargolito if removing it fixes it, then a) you can keep those settings in $HOME/.curlrc without needing the alias, and b) that means there's probably a place that nvm can harden itself against aliases clobbering builtins :-)

@gargolito
Copy link

gargolito commented Oct 24, 2022 via email

@jordyjwilliams
Copy link
Author

@ljharb any idea on my issue at all as to a possible cause? Any ideas on fixes. I could look into submitting a PR just wandering where to start with this... Where is the URL path specifically set based on os versions etc

@ljharb
Copy link
Member

ljharb commented Oct 25, 2022

@jordyjwilliams looking at your nvm debug, what happens if you remove your grep alias?

@jordyjwilliams
Copy link
Author

@ljharb looking at my zshrc I didn't have any grep alias' setup in my config... Not sure where this is coming from?

@ljharb
Copy link
Member

ljharb commented Oct 25, 2022

@jordyjwilliams .zprofile perhaps?

Even if you can't find the source, you can probably unalias grep and then run the nvm commands.

@ryenus
Copy link
Contributor

ryenus commented Nov 2, 2022

How about this: ryenus@nvm_curl

We can add nvm_curl and use it to bypass aliased curl, happy to raise a PR if needed.

@ljharb
Copy link
Member

ljharb commented Nov 2, 2022

@ryenus that as a PR would be great! altho i don't think we need nvm_curl, we can just inline the command.

@jordyjwilliams
Copy link
Author

jordyjwilliams commented Nov 2, 2022 via email

@ryenus
Copy link
Contributor

ryenus commented Nov 2, 2022

@ryenus that as a PR would be great! altho i don't think we need nvm_curl, we can just inline the command.

Sure, here it is: #2932

IMHO nvm_curl is a bit more preferable because we can also easily add the -q option to ignore ~/.curlrc.
Nevertheless, please feel free to amend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants