nvm-sh / nvm

Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions
MIT License
77.12k stars 7.75k forks source link

Nvm fails to install on bitbucket pipelines sometimes #3352

Open vivere-dally opened 1 month ago

vivere-dally commented 1 month ago

Operating system and version:

see docker image

How did you install nvm?

    export NVM_DIR="$PWD/nvmhome"
    mkdir "${NVM_DIR}"
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash

    echo "export NVM_DIR=\"${NVM_DIR}\"" >> ~/.bashrc
    echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' >> ~/.bashrc

    source ~/.bashrc

    nvm install 20.12.2

In my pipeline the nvm install command is flaky. Any lead to make it more stable? It fails quite often

Downloading and installing node v20.12.2...
Downloading https://nodejs.org/dist/v20.12.2/node-v20.12.2-linux-x64.tar.xz...
#=#=#                                                                         
                                                                           0.7%
                                                                           1.0%
                                                                           1.1%
#                                                                          1.5%
#                                                                          1.8%
#                                                                          2.0%
#                                                                          2.3%
#                                                                          2.7%
##                                                                         2.8%
##                                                                         3.2%
...
#####################################################################     96.6%
#####################################################################     96.8%
#####################################################################     97.0%curl: (92) HTTP/2 stream 1 was not closed cleanly: INTERNAL_ERROR (err 2)
Binary download from https://nodejs.org/dist/v20.12.2/node-v20.12.2-linux-x64.tar.xz failed, trying source.
grep: /opt/atlassian/pipelines/agent/build/nvmhome/.cache/bin/node-v20.12.2-linux-x64/node-v20.12.2-linux-x64.tar.xz: No such file or directory
Provided file to checksum does not exist.
Binary download failed, trying source.
Detected that you have 8 CPU core(s)
Running with 7 threads to speed up the build
Downloading https://nodejs.org/dist/v20.12.2/node-v20.12.2.tar.xz...

Then the install from source fails as well with the same curl error

hdomos commented 1 month ago

Same thing happens for us on bitbucket pipeline:


  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 16555  100 16555    0     0   376k      0 --:--:-- --:--:-- --:--:--  384k
=> Downloading nvm from git to '/root/.nvm'
Cloning into '/root/.nvm'...
fatal: unable to access 'https://github.com/nvm-sh/nvm.git/': Failed to connect to [github.com](http://github.com/) port 443 after 129735 ms: Couldn't connect to server
Failed to clone nvm repo. Please report this!```
ljharb commented 1 month ago

If it were just the first problem, I’d say it’s nodejs.org - but if bitbucket is unable to connect to GitHub also, that suggests an issue with bitbucket. Have you filed an issue with them?