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

Potential 0.40.0 regression on Github Actions runners #3405

Closed
AutomationD opened this issue Aug 8, 2024 · 21 comments
Closed

Potential 0.40.0 regression on Github Actions runners #3405

AutomationD opened this issue Aug 8, 2024 · 21 comments

Comments

@AutomationD
Copy link

AutomationD commented Aug 8, 2024

Poential 0.40.0 regression in Github Actions CI/CD

I tried to fill out the form, but it's quite hard as most things simply don't run.
Here is a set of test workflows that show the regression.

Operating system and version:

Ubuntu 22.04
(Github Runner version 20240804.1.0)

nvm debug output:

# Impossible to run directly

nvm ls output:

# Impossible to run directly

How did you install nvm?

Pre-installed on Github Runner

What steps did you perform?

cat .nvmrc
source ~/.nvm/nvm.sh && nvm install

What happened?

Received output:

18
Error: Process completed with exit code 3.

What did you expect to happen?

Install of the node version specified in .nvmrc (18)

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

I don't think so. It's a fresh Github Action runner

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

Please see workflow runs for demonstration of the apparent regression,

curl -I --compressed -v https://nodejs.org/dist/
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   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
*  CAfile: /etc/ssl/certs/ca-certificates.crt
*  CApath: /etc/ssl/certs
* TLSv1.0 (OUT), TLS header, Certificate Status (22):
} [5 bytes data]
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* TLSv1.2 (IN), TLS header, Certificate Status (22):
{ [5 bytes data]
* TLSv1.3 (IN), TLS handshake, Server hello (2):
{ [122 bytes data]
* TLSv1.2 (IN), TLS header, Finished (20):
{ [5 bytes data]
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
{ [19 bytes data]
* TLSv1.3 (IN), TLS handshake, Certificate (11):
{ [4835 bytes data]
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
{ [520 bytes data]
* TLSv1.3 (IN), TLS handshake, Finished (20):
{ [52 bytes data]
* TLSv1.2 (OUT), TLS header, Finished (20):
} [5 bytes data]
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
} [1 bytes data]
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
} [5 bytes data]
* TLSv1.3 (OUT), TLS handshake, Finished (20):
} [52 bytes data]
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN, server accepted to use h2
* Server certificate:
*  subject: CN=*.nodejs.org
*  start date: Feb 28 00:00:00 2024 GMT
*  expire date: Mar 30 23:59:59 2025 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 multiplexing
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
} [5 bytes data]
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
} [5 bytes data]
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
} [5 bytes data]
* Using Stream ID: 1 (easy handle 0x56543f0b8e20)
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
} [5 bytes data]
> HEAD /dist/ HTTP/2
> Host: nodejs.org
> user-agent: curl/7.81.0
> accept: */*
> accept-encoding: deflate, gzip, br, zstd
> 
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
{ [230 bytes data]
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
{ [230 bytes data]
* old SSL session ID is stale, removing
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
} [5 bytes data]
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
* TLSv1.2 (IN), TLS header, Supplemental data (23):
{ [5 bytes data]
< HTTP/2 200 
< date: Thu, 08 Aug 2024 12:30:09 GMT
< content-type: text/html
< cache-control: public, max-age=3600, s-maxage=14400
HTTP/2 200 
date: Thu, 08 Aug 2024 12:30:09 GMT
content-type: text/html
cache-control: public, max-age=3600, s-maxage=14400
last-modified: Thu, 08 Aug 2024 11:05:18 GMT
cf-cache-status: HIT
age: 4469
vary: Accept-Encoding
strict-transport-security: max-age=31536000; includeSubDomains; preload
x-content-type-options: nosniff
server: cloudflare
cf-ray: 8aff841c88317d52-LAX
content-encoding: br

< last-modified: Thu, 08 Aug 2024 11:05:18 GMT
< cf-cache-status: HIT
< age: 4469
< vary: Accept-Encoding
< strict-transport-security: max-age=31536000; includeSubDomains; preload
< x-content-type-options: nosniff
< server: cloudflare
< cf-ray: 8aff841c88317d52-LAX
< content-encoding: br
< 

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
* Connection #0 to host nodejs.org left intact
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
@ljharb
Copy link
Member

ljharb commented Aug 9, 2024

Do you set -e anywhere? Can you try those test workflows with set -x set?

(fwiw, i use nvm 0.40.0 in my own ljharb/actions, which runs on 500 of my projects, and these don't fail, so I'm trying to figure out what might have changed here)

@matthewhilton
Copy link

matthewhilton commented Aug 9, 2024

Here's a similar actions failing - i've added set -x https://github.com/matthewhilton/moodle-plugin-ci/actions/runs/10314237668/job/28552324807

Full output:

RUN  set -x && . /home/runner/.nvm/nvm.sh && nvm install && nvm use && echo "NVM_BIN=$NVM_BIN"
+ . /home/runner/.nvm/nvm.sh
+ NVM_SCRIPT_SOURCE=/home/runner/work/moodle-plugin-ci/moodle-plugin-ci/bin/moodle-plugin-ci
+ [ -z  ]
+ export NVM_CD_FLAGS=
+ nvm_is_zsh
+ [ -n  ]
+ [ -z /home/runner/.nvm ]
+ unset NVM_SCRIPT_SOURCE
+ nvm_process_parameters
+ local NVM_AUTO_MODE
+ NVM_AUTO_MODE=use
+ [ 0 -ne 0 ]
+ nvm_auto use
+ local NVM_MODE
+ NVM_MODE=use
+ local VERSION
+ local NVM_CURRENT
+ [ _use = _install ]
+ [ _use = _use ]
+ nvm_ls_current
+ local NVM_LS_CURRENT_NODE_PATH
+ command which node
+ NVM_LS_CURRENT_NODE_PATH=/usr/local/bin/node
+ nvm_version_dir iojs
+ local NVM_WHICH_DIR
+ NVM_WHICH_DIR=iojs
+ [ -z iojs ]
+ [ iojs = new ]
+ [ _iojs = _iojs ]
+ nvm_echo /home/runner/.nvm/versions/io.js
+ command printf %s\n /home/runner/.nvm/versions/io.js
+ nvm_tree_contains_path /home/runner/.nvm/versions/io.js /usr/local/bin/node
+ local tree
+ tree=/home/runner/.nvm/versions/io.js
+ local node_path
+ node_path=/usr/local/bin/node
+ [ @/home/runner/.nvm/versions/io.js@ = @@ ]
+ [ @/usr/local/bin/node@ = @@ ]
+ local previous_pathdir
+ previous_pathdir=/usr/local/bin/node
+ local pathdir
+ dirname /usr/local/bin/node
+ pathdir=/usr/local/bin
+ [ /usr/local/bin !=  ]
+ [ /usr/local/bin != . ]
+ [ /usr/local/bin != / ]
+ [ /usr/local/bin != /home/runner/.nvm/versions/io.js ]
+ [ /usr/local/bin != /usr/local/bin/node ]
+ previous_pathdir=/usr/local/bin
+ dirname /usr/local/bin
+ pathdir=/usr/local
+ [ /usr/local !=  ]
+ [ /usr/local != . ]
+ [ /usr/local != / ]
+ [ /usr/local != /home/runner/.nvm/versions/io.js ]
+ [ /usr/local != /usr/local/bin ]
+ previous_pathdir=/usr/local
+ dirname /usr/local
+ pathdir=/usr
+ [ /usr !=  ]
+ [ /usr != . ]
+ [ /usr != / ]
+ [ /usr != /home/runner/.nvm/versions/io.js ]
+ [ /usr != /usr/local ]
+ previous_pathdir=/usr
+ dirname /usr
+ pathdir=/
+ [ -n  ]
+ local NVM_DIRS_TO_SEARCH1
+ NVM_DIRS_TO_SEARCH1=
+ local NVM_DIRS_TO_SEARCH2
+ NVM_DIRS_TO_SEARCH2=
+ local NVM_DIRS_TO_SEARCH3
+ NVM_DIRS_TO_SEARCH3=
+ local NVM_ADD_SYSTEM
+ NVM_ADD_SYSTEM=false
+ nvm_is_iojs_version lts/gallium.
+ return 1
+ [ lts/gallium. = node- ]
+ NVM_DIRS_TO_SEARCH1=/home/runner/.nvm
+ NVM_DIRS_TO_SEARCH2=/home/runner/.nvm/versions/node
+ NVM_DIRS_TO_SEARCH3=/home/runner/.nvm/versions/io.js
+ nvm_has_system_iojs
+ nvm deactivate
+ command -v iojs
+ [  !=  ]
+ nvm_has_system_node
+ nvm deactivate
+ command -v node
+ [ /usr/local/bin/node !=  ]
+ NVM_ADD_SYSTEM=true
+ [ -d /home/runner/.nvm ]
+ command ls -1qA /home/runner/.nvm
+ nvm_grep -q .
+ GREP_OPTIONS= command grep -q .
+ [ -d /home/runner/.nvm/versions/node ]
+ NVM_DIRS_TO_SEARCH2=/home/runner/.nvm
+ [ -d /home/runner/.nvm/versions/io.js ]
+ NVM_DIRS_TO_SEARCH3=/home/runner/.nvm
+ local SEARCH_PATTERN
+ [ -z lts/gallium. ]
+ nvm_echo+ command sed s#\.#\\\.#g;
 lts/gallium.
+ command printf %s\n lts/gallium.
+ SEARCH_PATTERN=lts/gallium\.
+ [ -n /home/runner/.nvm/home/runner/.nvm/home/runner/.nvm ]
+ command find /home/runner/.nvm/CODE_OF_CONDUCT.md /home/runner/.nvm/CONTRIBUTING.md /home/runner/.nvm/Dockerfile /home/runner/.nvm/GOVERNANCE.md /home/runner/.nvm/LICENSE.md /home/runner/.nvm/Makefile /home/runner/.nvm/PROJECT_CHARTER.md /home/runner/.nvm/README.md /home/runner/.nvm/ROADMAP.md /home/runner/.nvm/alias /home/runner/.nvm/bash_completion /home/runner/.nvm/install.sh /home/runner/.nvm/nvm-exec /home/runner/.nvm/nvm.sh /home/runner/.nvm/package.json /home/runner/.nvm/rename_test.sh /home/runner/.nvm/test /home/runner/.nvm/update_test_mocks.sh /home/runner/.nvm/CODE_OF_CONDUCT.md /home/runner/.nvm/CONTRIBUTING.md /home/runner/.nvm/Dockerfile /home/runner/.nvm/GOVERNANCE.md /home/runner/.nvm/LICENSE.md /home/runner/.nvm/Makefile /home/runner/.nvm/PROJECT_CHARTER.md /home/runner/.nvm/README.md /home/runner/.nvm/ROADMAP.md /home/runner/.nvm/alias /home/runner/.nvm/bash_completion /home/runner/.nvm/install.sh /home/runner/.nvm/nvm-exec /home/runner/.nvm/nvm.sh+  /home/runner/.nvm/package.json /home/runner/.nvm/rename_test.sh /home/runner/.nvm/test /home/runner/.nvm/update_test_mocks.sh /home/runner/.nvm/CODE_OF_CONDUCT.md /home/runner/.nvm/CONTRIBUTING.md /home/runner/.nvm/Dockerfile /home/runner/.nvm/GOVERNANCE.md /home/runner/.nvm/LICENSE.md /home/runner/.nvm/Makefile /home/runner/.nvm/PROJECT_CHARTER.mdcommand /home/runner/.nvm/README.md sed /home/runner/.nvm/ROADMAP.md -e /home/runner/.nvm/alias /home/runner/.nvm/bash_completion 
            s#/home/runner/.nvm/versions/io.js/#versions/iojs/#;
            s#^/home/runner/.nvm/##;
            \#^[^v]# d;
            \#^versions$# d;
            s#^versions/##;
            s#^v#node/v#;
            \#lts/gallium\.# !d;
           /home/runner/.nvm/install.sh -e /home/runner/.nvm/nvm-exec s#^\([^/]\{1,\}\)/\(.*\)$#\2.\1#; /home/runner/.nvm/nvm.sh
 /home/runner/.nvm/package.json /home/runner/.nvm/rename_test.sh /home/runner/.nvm/test /home/runner/.nvm/update_test_mocks.sh -name . -o -type d -prune -o -path lts/gallium.*
+ command sed -e s#\(.*\)\.\([^\.]\{1,\}\)$#\2-\1#; -e s#^node-##;
+ command sort -t. -u -k 1.2,1n -k 2,2n -k 3,3n
+ VERSIONS=
+ [ true = true ]
+ [ -z lts/gallium. ]
+ [ lts/gallium. = v ]
+ [ lts/gallium. = system ]
+ [ -z  ]
+ nvm_echo N/A
+ command printf %s\n N/A
+ return 3
+ VERSION=N/A
+ [ -z N/A ]
+ [ _N/A = _N/A ]
+ nvm_echo N/A
+ command printf %s\n N/A
+ return 3
+ VERSION=N/A
+ unset NVM_RC_VERSION
+ [ -z N/A ]
+ [ -z N/A ]
+ [ 0 -eq 1 ]
+ [ _N/A = _system ]
+ [ _N/A = _∞ ]
+ [ N/A = N/A ]
+ [ 1 -ne 1 ]
+ return 3

I wonder if the difference is that your projects might have .nvmrc but ours don't ?

@matthewhilton
Copy link

matthewhilton commented Aug 9, 2024

Adding onto my previous comment, I think there might be a bug / edge case with .nvmrc handling.

In my github action I did echo .nvmrc and saw it had lts/iron i.e. 20.9.0.
I tried overwriting this with the latest lts 20.16.0 but the same error.
Lastly I tried removing the .nvmrc file entirely, and using nvm install 20.16.0 and nvm use 20.16.0 which worked and node installed properly.

The final working command for reference: rm .nvmrc && . $nvmDir/nvm.sh && nvm install 20.16.0 && nvm use 20.16.0

@ljharb
Copy link
Member

ljharb commented Aug 9, 2024

hmm, it looks like it's getting lts/gallium. - note the trailing period - from somewhere. is that perhaps in your nvmrc?

@AutomationD
Copy link
Author

Adding onto my previous comment, I think there might be a bug / edge case with .nvmrc handling.

In my github action I did echo .nvmrc and saw it had lts/iron i.e. 20.9.0.

I tried overwriting this with the latest lts 20.16.0 but the same error.

Lastly I tried removing the .nvmrc file entirely, and using nvm install 20.16.0 and nvm use 20.16.0 which worked and node installed properly.

The final working command for reference: rm .nvmrc && . $nvmDir/nvm.sh && nvm install 20.16.0 && nvm use 20.16.0

The issue is definitely happening only when there is an .nvmrc present. I ran bash in debug mode (-xv), and I believe it was failing when trying to parse it.

It seems that 0.40.0 added comments support to .nvmrc, so it sounds like it might be a regression root (not confident).

I will add -xv back post the output when I'm back to this.

@AutomationD
Copy link
Author

AutomationD commented Aug 9, 2024

Do you set -e anywhere? Can you try those test workflows with set -x set?

(fwiw, i use nvm 0.40.0 in my own ljharb/actions, which runs on 500 of my projects, and these don't fail, so I'm trying to figure out what might have changed here)

I don't think I use -e anywhere (see the test workflow I've created to reproduce this issue. It's super simple)
I've added -xv to the bash in Github Actions Workflow

Details
} # this ensures the entire script is downloaded #
++ NVM_SCRIPT_SOURCE=/usr/bin/bash
++ '[' -z '' ']'
++ export NVM_CD_FLAGS=
++ NVM_CD_FLAGS=
++ nvm_is_zsh
++ '[' -n '' ']'
++ '[' -z /home/runner/.nvm ']'
++ case $NVM_DIR in
++ unset NVM_SCRIPT_SOURCE
++ nvm_process_parameters
++ local NVM_AUTO_MODE
++ NVM_AUTO_MODE=use
++ '[' 0 -ne 0 ']'
++ nvm_auto use
++ local NVM_MODE
++ NVM_MODE=use
++ local VERSION
++ local NVM_CURRENT
++ '[' _use = _install ']'
++ '[' _use = _use ']'
+++ nvm_ls_current
+++ local NVM_LS_CURRENT_NODE_PATH
++++ command which node
+++ NVM_LS_CURRENT_NODE_PATH=/usr/local/bin/node
++++ nvm_version_dir iojs
++++ local NVM_WHICH_DIR
++++ NVM_WHICH_DIR=iojs
++++ '[' -z iojs ']'
++++ '[' iojs = new ']'
++++ '[' _iojs = _iojs ']'
++++ nvm_echo /home/runner/.nvm/versions/io.js
++++ command printf '%s\n' /home/runner/.nvm/versions/io.js
+++ nvm_tree_contains_path /home/runner/.nvm/versions/io.js /usr/local/bin/node
+++ local tree
+++ tree=/home/runner/.nvm/versions/io.js
+++ local node_path
+++ node_path=/usr/local/bin/node
+++ '[' @/home/runner/.nvm/versions/io.js@ = @@ ']'
+++ '[' @/usr/local/bin/node@ = @@ ']'
+++ local previous_pathdir
+++ previous_pathdir=/usr/local/bin/node
+++ local pathdir
++++ dirname /usr/local/bin/node
+++ pathdir=/usr/local/bin
+++ '[' /usr/local/bin '!=' '' ']'
+++ '[' /usr/local/bin '!=' . ']'
+++ '[' /usr/local/bin '!=' / ']'
+++ '[' /usr/local/bin '!=' /home/runner/.nvm/versions/io.js ']'
+++ '[' /usr/local/bin '!=' /usr/local/bin/node ']'
+++ previous_pathdir=/usr/local/bin
++++ dirname /usr/local/bin
+++ pathdir=/usr/local
+++ '[' /usr/local '!=' '' ']'
+++ '[' /usr/local '!=' . ']'
+++ '[' /usr/local '!=' / ']'
+++ '[' /usr/local '!=' /home/runner/.nvm/versions/io.js ']'
+++ '[' /usr/local '!=' /usr/local/bin ']'
+++ previous_pathdir=/usr/local
++++ dirname /usr/local
+++ pathdir=/usr
+++ '[' /usr '!=' '' ']'
+++ '[' /usr '!=' . ']'
+++ '[' /usr '!=' / ']'
+++ '[' /usr '!=' /home/runner/.nvm/versions/io.js ']'
+++ '[' /usr '!=' /usr/local ']'
+++ previous_pathdir=/usr
++++ dirname /usr
+++ pathdir=/
+++ '[' / '!=' '' ']'
+++ '[' / '!=' . ']'
+++ '[' / '!=' / ']'
+++ '[' / = /home/runner/.nvm/versions/io.js ']'
+++ nvm_tree_contains_path /home/runner/.nvm /usr/local/bin/node
+++ local tree
+++ tree=/home/runner/.nvm
+++ local node_path
+++ node_path=/usr/local/bin/node
+++ '[' @/home/runner/.nvm@ = @@ ']'
+++ '[' @/usr/local/bin/node@ = @@ ']'
+++ local previous_pathdir
+++ previous_pathdir=/usr/local/bin/node
+++ local pathdir
++++ dirname /usr/local/bin/node
+++ pathdir=/usr/local/bin
+++ '[' /usr/local/bin '!=' '' ']'
+++ '[' /usr/local/bin '!=' . ']'
+++ '[' /usr/local/bin '!=' / ']'
+++ '[' /usr/local/bin '!=' /home/runner/.nvm ']'
+++ '[' /usr/local/bin '!=' /usr/local/bin/node ']'
+++ previous_pathdir=/usr/local/bin
++++ dirname /usr/local/bin
+++ pathdir=/usr/local
+++ '[' /usr/local '!=' '' ']'
+++ '[' /usr/local '!=' . ']'
+++ '[' /usr/local '!=' / ']'
+++ '[' /usr/local '!=' /home/runner/.nvm ']'
+++ '[' /usr/local '!=' /usr/local/bin ']'
+++ previous_pathdir=/usr/local
++++ dirname /usr/local
+++ pathdir=/usr
+++ '[' /usr '!=' '' ']'
+++ '[' /usr '!=' . ']'
+++ '[' /usr '!=' / ']'
+++ '[' /usr '!=' /home/runner/.nvm ']'
+++ '[' /usr '!=' /usr/local ']'
+++ previous_pathdir=/usr
++++ dirname /usr
+++ pathdir=/
+++ '[' / '!=' '' ']'
+++ '[' / '!=' . ']'
+++ '[' / '!=' / ']'
+++ '[' / = /home/runner/.nvm ']'
+++ nvm_echo system
+++ command printf '%s\n' system
++ NVM_CURRENT=system
++ '[' _system = _none ']'
++ '[' _system = _system ']'
+++ nvm_resolve_local_alias default
++ VERSION=system
++ '[' -n system ']'
++ '[' _system = _N/A ']'
++ nvm_is_valid_version system
++ nvm_validate_implicit_alias system
++ case "${1-}" in
+++ nvm_iojs_prefix
+++ nvm_echo iojs
+++ command printf '%s\n' iojs
+++ nvm_node_prefix
+++ nvm_echo node
+++ command printf '%s\n' node
++ local VERSION
+++ nvm_strip_iojs_prefix system
+++ local NVM_IOJS_PREFIX
++++ nvm_iojs_prefix
++++ nvm_echo iojs
++++ command printf '%s\n' iojs
+++ NVM_IOJS_PREFIX=iojs
+++ '[' system = iojs ']'
+++ nvm_echo system
+++ command printf '%s\n' system
++ VERSION=system
++ nvm_version_greater_than_or_equal_to system 0
++ command awk 'BEGIN {
    if (ARGV[1] == "" || ARGV[2] == "") exit(1)
    split(ARGV[1], a, /\./);
    split(ARGV[2], b, /\./);
    for (i=1; i<=3; i++) {
      if (a[i] && a[i] !~ /^[0-9]+$/) exit(2);
      if (a[i] < b[i]) exit(3);
      else if (a[i] > b[i]) exit(0);
    }
    exit(0)
  }' system 0
++ nvm_rc_version
++ nvm use --silent
++ '[' 2 -lt 1 ']'
++ local DEFAULT_IFS
+++ nvm_echo t
+++ command printf '%s\n' t
+++ command tr t '\t'
++ DEFAULT_IFS=' 	
'
++ '[' hvxBc '!=' hvxBc ']'
++ '[' hvxBc '!=' hvxBc ']'
++ '[' -n /usr/bin/bash ']'
++ '[' hvxBc '!=' hvxBc ']'
++ '[' ' 	
' '!=' ' 	
' ']'
++ local i
++ for i in "$@"
++ case $i in
++ for i in "$@"
++ case $i in
++ local COMMAND
++ COMMAND=use
++ shift
++ local VERSION
++ local ADDITIONAL_PARAMETERS
++ case $COMMAND in
++ local PROVIDED_VERSION
++ local NVM_SILENT
++ local NVM_SILENT_ARG
++ local NVM_DELETE_PREFIX
++ NVM_DELETE_PREFIX=0
++ local NVM_LTS
++ local IS_VERSION_FROM_NVMRC
++ IS_VERSION_FROM_NVMRC=0
++ '[' 1 -ne 0 ']'
++ case "$1" in
++ NVM_SILENT=1
++ NVM_SILENT_ARG=--silent
++ shift
++ '[' 0 -ne 0 ']'
++ '[' -n '' ']'
++ '[' -z '' ']'
++ NVM_SILENT=1
++ nvm_rc_version
++ export NVM_RC_VERSION=
++ NVM_RC_VERSION=
++ local NVMRC_PATH
+++ nvm_find_nvmrc
+++ local dir
++++ nvm_find_up .nvmrc
++++ local path_
++++ path_=/home/runner/work/ize/ize
++++ '[' /home/runner/work/ize/ize '!=' '' ']'
++++ '[' /home/runner/work/ize/ize '!=' . ']'
++++ '[' '!' -f /home/runner/work/ize/ize/.nvmrc ']'
++++ nvm_echo /home/runner/work/ize/ize
++++ command printf '%s\n' /home/runner/work/ize/ize
+++ dir=/home/runner/work/ize/ize
+++ '[' -e /home/runner/work/ize/ize/.nvmrc ']'
+++ nvm_echo /home/runner/work/ize/ize/.nvmrc
+++ command printf '%s\n' /home/runner/work/ize/ize/.nvmrc
++ NVMRC_PATH=/home/runner/work/ize/ize/.nvmrc
++ '[' '!' -e /home/runner/work/ize/ize/.nvmrc ']'
+++ nvm_process_nvmrc /home/runner/work/ize/ize/.nvmrc
+++ local NVMRC_PATH=/home/runner/work/ize/ize/.nvmrc
+++ local lines
+++ local unpaired_line
++++ command sed 's/#.*//' /home/runner/work/ize/ize/.nvmrc
++++ nvm_grep -v '^$'
++++ GREP_OPTIONS=
++++ command grep -v '^$'
++++ command sed 's/^[[:space:]]*//;s/[[:space:]]*$//'
+++ lines=18
+++ '[' -z 18 ']'
+++ local keys=
+++ local values=
+++ IFS=
+++ read -r line
+++ '[' -z 18 ']'
+++ '[' -z 18 ']'
+++ case "$line" in
+++ false
+++ '[' -n '' ']'
+++ unpaired_line=18
+++ IFS=
+++ read -r line
+++ '[' -z 18 ']'
+++ nvm_echo 18
+++ command printf '%s\n' 18
++ NVM_RC_VERSION=18
++ '[' -z 18 ']'
++ '[' 1 -ne 1 ']'
++ '[' -n 18 ']'
++ PROVIDED_VERSION=18
++ IS_VERSION_FROM_NVMRC=1
+++ nvm_version 18
+++ local PATTERN
+++ PATTERN=18
+++ local VERSION
+++ '[' -z 18 ']'
+++ '[' 18 = current ']'
+++ local NVM_NODE_PREFIX
++++ nvm_node_prefix
++++ nvm_echo node
++++ command printf '%s\n' node
+++ NVM_NODE_PREFIX=node
+++ case "_${PATTERN}" in
++++ nvm_ls 18
++++ local PATTERN
++++ PATTERN=18
++++ local VERSIONS
++++ VERSIONS=
++++ '[' 18 = current ']'
++++ local NVM_IOJS_PREFIX
++++ command tail -1
+++++ nvm_iojs_prefix
+++++ nvm_echo iojs
+++++ command printf '%s\n' iojs
++++ NVM_IOJS_PREFIX=iojs
++++ local NVM_NODE_PREFIX
+++++ nvm_node_prefix
+++++ nvm_echo node
+++++ command printf '%s\n' node
++++ NVM_NODE_PREFIX=node
++++ local NVM_VERSION_DIR_IOJS
+++++ nvm_version_dir iojs
+++++ local NVM_WHICH_DIR
+++++ NVM_WHICH_DIR=iojs
+++++ '[' -z iojs ']'
+++++ '[' iojs = new ']'
+++++ '[' _iojs = _iojs ']'
+++++ nvm_echo /home/runner/.nvm/versions/io.js
+++++ command printf '%s\n' /home/runner/.nvm/versions/io.js
++++ NVM_VERSION_DIR_IOJS=/home/runner/.nvm/versions/io.js
++++ local NVM_VERSION_DIR_NEW
+++++ nvm_version_dir new
+++++ local NVM_WHICH_DIR
+++++ NVM_WHICH_DIR=new
+++++ '[' -z new ']'
+++++ '[' new = new ']'
+++++ nvm_echo /home/runner/.nvm/versions/node
+++++ command printf '%s\n' /home/runner/.nvm/versions/node
++++ NVM_VERSION_DIR_NEW=/home/runner/.nvm/versions/node
++++ local NVM_VERSION_DIR_OLD
+++++ nvm_version_dir old
+++++ local NVM_WHICH_DIR
+++++ NVM_WHICH_DIR=old
+++++ '[' -z old ']'
+++++ '[' old = new ']'
+++++ '[' _old = _iojs ']'
+++++ '[' _old = _old ']'
+++++ nvm_echo /home/runner/.nvm
+++++ command printf '%s\n' /home/runner/.nvm
++++ NVM_VERSION_DIR_OLD=/home/runner/.nvm
++++ case "${PATTERN}" in
++++ nvm_resolve_local_alias 18
++++ '[' -z 18 ']'
++++ local VERSION
++++ local EXIT_CODE
+++++ nvm_resolve_alias 18
+++++ '[' -z 18 ']'
+++++ local PATTERN
+++++ PATTERN=18
+++++ local ALIAS
+++++ ALIAS=18
+++++ local ALIAS_TEMP
+++++ local SEEN_ALIASES
+++++ SEEN_ALIASES=18
+++++ local NVM_ALIAS_INDEX
+++++ NVM_ALIAS_INDEX=1
+++++ true
++++++ nvm_alias 18
++++++ command head -n 1
++++++ command tail -n 1
+++++ ALIAS_TEMP=
+++++ '[' -z '' ']'
+++++ break
+++++ '[' -n 18 ']'
+++++ '[' _18 '!=' _18 ']'
+++++ nvm_validate_implicit_alias 18
+++++ return 2
++++ VERSION=
++++ EXIT_CODE=2
++++ '[' -z '' ']'
++++ return 2
+++++ nvm_ensure_version_prefix 18
+++++ local NVM_VERSION
++++++ nvm_strip_iojs_prefix 18
++++++ local NVM_IOJS_PREFIX
++++++ command sed -e 's/^\([0-9]\)/v\1/g'
+++++++ nvm_iojs_prefix
+++++++ nvm_echo iojs
+++++++ command printf '%s\n' iojs
++++++ NVM_IOJS_PREFIX=iojs
++++++ '[' 18 = iojs ']'
++++++ nvm_echo 18
++++++ command printf '%s\n' 18
+++++ NVM_VERSION=v18
+++++ nvm_is_iojs_version 18
+++++ case "${1-}" in
+++++ return 1
+++++ nvm_echo v18
+++++ command printf '%s\n' v18
++++ PATTERN=v18
++++ '[' v18 = N/A ']'
++++ local NVM_PATTERN_STARTS_WITH_V
++++ case $PATTERN in
++++ NVM_PATTERN_STARTS_WITH_V=true
++++ '[' true = true ']'
+++++ nvm_num_version_groups v18
+++++ local VERSION
+++++ VERSION=v18
+++++ VERSION=18
+++++ VERSION=18
+++++ '[' -z 18 ']'
+++++ local NVM_NUM_DOTS
++++++ nvm_echo 18
++++++ command printf '%s\n' 18
++++++ command sed -e 's/[^\.]//g'
+++++ NVM_NUM_DOTS=
+++++ local NVM_NUM_GROUPS
+++++ NVM_NUM_GROUPS=.
+++++ nvm_echo 1
+++++ command printf '%s\n' 1
++++ '[' _1 = _3 ']'
++++ case "${PATTERN}" in
++++ local NUM_VERSION_GROUPS
+++++ nvm_num_version_groups v18
+++++ local VERSION
+++++ VERSION=v18
+++++ VERSION=18
+++++ VERSION=18
+++++ '[' -z 18 ']'
+++++ local NVM_NUM_DOTS
++++++ nvm_echo 18
++++++ command printf '%s\n' 18
++++++ command sed -e 's/[^\.]//g'
+++++ NVM_NUM_DOTS=
+++++ local NVM_NUM_GROUPS
+++++ NVM_NUM_GROUPS=.
+++++ nvm_echo 1
+++++ command printf '%s\n' 1
++++ NUM_VERSION_GROUPS=1
++++ '[' 1 = 2 ']'
++++ '[' 1 = 1 ']'
++++ PATTERN=v18.
++++ nvm_is_zsh
++++ '[' -n '' ']'
++++ nvm_is_zsh
++++ '[' -n '' ']'
++++ local NVM_DIRS_TO_SEARCH1
++++ NVM_DIRS_TO_SEARCH1=
++++ local NVM_DIRS_TO_SEARCH2
++++ NVM_DIRS_TO_SEARCH2=
++++ local NVM_DIRS_TO_SEARCH3
++++ NVM_DIRS_TO_SEARCH3=
++++ local NVM_ADD_SYSTEM
++++ NVM_ADD_SYSTEM=false
++++ nvm_is_iojs_version v18.
++++ case "${1-}" in
++++ return 1
++++ '[' v18. = node- ']'
++++ NVM_DIRS_TO_SEARCH1=/home/runner/.nvm
++++ NVM_DIRS_TO_SEARCH2=/home/runner/.nvm/versions/node
++++ NVM_DIRS_TO_SEARCH3=/home/runner/.nvm/versions/io.js
++++ nvm_has_system_iojs
+++++ nvm deactivate
+++++ command -v iojs
++++ '[' '' '!=' '' ']'
++++ nvm_has_system_node
+++++ nvm deactivate
+++++ command -v node
++++ '[' /usr/local/bin/node '!=' '' ']'
++++ NVM_ADD_SYSTEM=true
++++ '[' -d /home/runner/.nvm ']'
++++ command ls -1qA /home/runner/.nvm
++++ nvm_grep -q .
++++ GREP_OPTIONS=
++++ command grep -q .
++++ '[' -d /home/runner/.nvm/versions/node ']'
++++ NVM_DIRS_TO_SEARCH2=/home/runner/.nvm
++++ '[' -d /home/runner/.nvm/versions/io.js ']'
++++ NVM_DIRS_TO_SEARCH3=/home/runner/.nvm
++++ local SEARCH_PATTERN
++++ '[' -z v18. ']'
+++++ nvm_echo v18.
+++++ command printf '%s\n' v18.
+++++ command sed 's#\.#\\\.#g;'
++++ SEARCH_PATTERN='v18\.'
++++ '[' -n /home/runner/.nvm/home/runner/.nvm/home/runner/.nvm ']'
+++++ command find /home/runner/.nvm/CODE_OF_CONDUCT.md /home/runner/.nvm/CONTRIBUTING.md /home/runner/.nvm/Dockerfile /home/runner/.nvm/GOVERNANCE.md /home/runner/.nvm/LICENSE.md /home/runner/.nvm/Makefile /home/runner/.nvm/PROJECT_CHARTER.md /home/runner/.nvm/README.md /home/runner/.nvm/ROADMAP.md /home/runner/.nvm/alias /home/runner/.nvm/bash_completion /home/runner/.nvm/install.sh /home/runner/.nvm/nvm-exec /home/runner/.nvm/nvm.sh /home/runner/.nvm/package.json /home/runner/.nvm/rename_test.sh /home/runner/.nvm/test /home/runner/.nvm/update_test_mocks.sh /home/runner/.nvm/CODE_OF_CONDUCT.md /home/runner/.nvm/CONTRIBUTING.md /home/runner/.nvm/Dockerfile /home/runner/.nvm/GOVERNANCE.md /home/runner/.nvm/LICENSE.md /home/runner/.nvm/Makefile /home/runner/.nvm/PROJECT_CHARTER.md /home/runner/.nvm/README.md /home/runner/.nvm/ROADMAP.md /home/runner/.nvm/alias /home/runner/.nvm/bash_completion /home/runner/.nvm/install.sh /home/runner/.nvm/nvm-exec /home/runner/.nvm/nvm.sh /home/runner/.nvm/package.json /home/runner/.nvm/rename_test.sh /home/runner/.nvm/test /home/runner/.nvm/update_test_mocks.sh /home/runner/.nvm/CODE_OF_CONDUCT.md /home/runner/.nvm/CONTRIBUTING.md /home/runner/.nvm/Dockerfile /home/runner/.nvm/GOVERNANCE.md /home/runner/.nvm/LICENSE.md /home/runner/.nvm/Makefile /home/runner/.nvm/PROJECT_CHARTER.md /home/runner/.nvm/README.md /home/runner/.nvm/ROADMAP.md /home/runner/.nvm/alias /home/runner/.nvm/bash_completion /home/runner/.nvm/install.sh /home/runner/.nvm/nvm-exec /home/runner/.nvm/nvm.sh /home/runner/.nvm/package.json /home/runner/.nvm/rename_test.sh /home/runner/.nvm/test /home/runner/.nvm/update_test_mocks.sh -name . -o -type d -prune -o -path 'v18.*'
+++++ command sed -e '
            s#/home/runner/.nvm/versions/io.js/#versions/iojs/#;
            s#^/home/runner/.nvm/##;
            \#^[^v]# d;
            \#^versions$# d;
            s#^versions/##;
            s#^v#node/v#;
            \#v18\.# !d;
          ' -e 's#^\([^/]\{1,\}\)/\(.*\)$#\2.\1#;'
+++++ command sed -e 's#\(.*\)\.\([^\.]\{1,\}\)$#\2-\1#;' -e 's#^node-##;'
+++++ command sort -t. -u -k 1.2,1n -k 2,2n -k 3,3n
++++ VERSIONS=
++++ '[' true = true ']'
++++ '[' -z v18. ']'
++++ '[' v18. = v ']'
++++ '[' v18. = system ']'
++++ '[' -z '' ']'
++++ nvm_echo N/A
++++ command printf '%s\n' N/A
++++ return 3
+++ VERSION=N/A
+++ '[' -z N/A ']'
+++ '[' _N/A = _N/A ']'
+++ nvm_echo N/A
+++ command printf '%s\n' N/A
+++ return 3
++ VERSION=N/A
++ unset NVM_RC_VERSION
++ '[' -z N/A ']'
++ '[' -z N/A ']'
++ '[' 0 -eq 1 ']'
++ '[' _N/A = _system ']'
++ '[' _N/A = _∞ ']'
++ '[' N/A = N/A ']'
++ '[' 1 -ne 1 ']'
++ return 3

Edit: updated the run to match the install

@AutomationD
Copy link
Author

AutomationD commented Aug 9, 2024

Do you set -e anywhere? Can you try those test workflows with set -x set?
(fwiw, i use nvm 0.40.0 in my own ljharb/actions, which runs on 500 of my projects, and these don't fail, so I'm trying to figure out what might have changed here)

I don't think I use -e anywhere (see the test workflow I've created to reproduce this issue. It's super simple) I've added -xv to the bash in Github Actions Workflow

Details

} # this ensures the entire script is downloaded #
++ NVM_SCRIPT_SOURCE=/usr/bin/bash
++ '[' -z '' ']'
++ export NVM_CD_FLAGS=
++ NVM_CD_FLAGS=
++ nvm_is_zsh
++ '[' -n '' ']'
++ '[' -z /home/runner/.nvm ']'
++ case $NVM_DIR in
++ unset NVM_SCRIPT_SOURCE
++ nvm_process_parameters
++ local NVM_AUTO_MODE
++ NVM_AUTO_MODE=use
++ '[' 0 -ne 0 ']'
++ nvm_auto use
++ local NVM_MODE
++ NVM_MODE=use
++ local VERSION
++ local NVM_CURRENT
++ '[' _use = _install ']'
++ '[' _use = _use ']'
+++ nvm_ls_current
+++ local NVM_LS_CURRENT_NODE_PATH
++++ command which node
+++ NVM_LS_CURRENT_NODE_PATH=/usr/local/bin/node
++++ nvm_version_dir iojs
++++ local NVM_WHICH_DIR
++++ NVM_WHICH_DIR=iojs
++++ '[' -z iojs ']'
++++ '[' iojs = new ']'
++++ '[' _iojs = _iojs ']'
++++ nvm_echo /home/runner/.nvm/versions/io.js
++++ command printf '%s\n' /home/runner/.nvm/versions/io.js
+++ nvm_tree_contains_path /home/runner/.nvm/versions/io.js /usr/local/bin/node
+++ local tree
+++ tree=/home/runner/.nvm/versions/io.js
+++ local node_path
+++ node_path=/usr/local/bin/node
+++ '[' @/home/runner/.nvm/versions/io.js@ = @@ ']'
+++ '[' @/usr/local/bin/node@ = @@ ']'
+++ local previous_pathdir
+++ previous_pathdir=/usr/local/bin/node
+++ local pathdir
++++ dirname /usr/local/bin/node
+++ pathdir=/usr/local/bin
+++ '[' /usr/local/bin '!=' '' ']'
+++ '[' /usr/local/bin '!=' . ']'
+++ '[' /usr/local/bin '!=' / ']'
+++ '[' /usr/local/bin '!=' /home/runner/.nvm/versions/io.js ']'
+++ '[' /usr/local/bin '!=' /usr/local/bin/node ']'
+++ previous_pathdir=/usr/local/bin
++++ dirname /usr/local/bin
+++ pathdir=/usr/local
+++ '[' /usr/local '!=' '' ']'
+++ '[' /usr/local '!=' . ']'
+++ '[' /usr/local '!=' / ']'
+++ '[' /usr/local '!=' /home/runner/.nvm/versions/io.js ']'
+++ '[' /usr/local '!=' /usr/local/bin ']'
+++ previous_pathdir=/usr/local
++++ dirname /usr/local
+++ pathdir=/usr
+++ '[' /usr '!=' '' ']'
+++ '[' /usr '!=' . ']'
+++ '[' /usr '!=' / ']'
+++ '[' /usr '!=' /home/runner/.nvm/versions/io.js ']'
+++ '[' /usr '!=' /usr/local ']'
+++ previous_pathdir=/usr
++++ dirname /usr
+++ pathdir=/
+++ '[' / '!=' '' ']'
+++ '[' / '!=' . ']'
+++ '[' / '!=' / ']'
+++ '[' / = /home/runner/.nvm/versions/io.js ']'
+++ nvm_tree_contains_path /home/runner/.nvm /usr/local/bin/node
+++ local tree
+++ tree=/home/runner/.nvm
+++ local node_path
+++ node_path=/usr/local/bin/node
+++ '[' @/home/runner/.nvm@ = @@ ']'
+++ '[' @/usr/local/bin/node@ = @@ ']'
+++ local previous_pathdir
+++ previous_pathdir=/usr/local/bin/node
+++ local pathdir
++++ dirname /usr/local/bin/node
+++ pathdir=/usr/local/bin
+++ '[' /usr/local/bin '!=' '' ']'
+++ '[' /usr/local/bin '!=' . ']'
+++ '[' /usr/local/bin '!=' / ']'
+++ '[' /usr/local/bin '!=' /home/runner/.nvm ']'
+++ '[' /usr/local/bin '!=' /usr/local/bin/node ']'
+++ previous_pathdir=/usr/local/bin
++++ dirname /usr/local/bin
+++ pathdir=/usr/local
+++ '[' /usr/local '!=' '' ']'
+++ '[' /usr/local '!=' . ']'
+++ '[' /usr/local '!=' / ']'
+++ '[' /usr/local '!=' /home/runner/.nvm ']'
+++ '[' /usr/local '!=' /usr/local/bin ']'
+++ previous_pathdir=/usr/local
++++ dirname /usr/local
+++ pathdir=/usr
+++ '[' /usr '!=' '' ']'
+++ '[' /usr '!=' . ']'
+++ '[' /usr '!=' / ']'
+++ '[' /usr '!=' /home/runner/.nvm ']'
+++ '[' /usr '!=' /usr/local ']'
+++ previous_pathdir=/usr
++++ dirname /usr
+++ pathdir=/
+++ '[' / '!=' '' ']'
+++ '[' / '!=' . ']'
+++ '[' / '!=' / ']'
+++ '[' / = /home/runner/.nvm ']'
+++ nvm_echo system
+++ command printf '%s\n' system
++ NVM_CURRENT=system
++ '[' _system = _none ']'
++ '[' _system = _system ']'
+++ nvm_resolve_local_alias default
++ VERSION=system
++ '[' -n system ']'
++ '[' _system = _N/A ']'
++ nvm_is_valid_version system
++ nvm_validate_implicit_alias system
++ case "${1-}" in
+++ nvm_iojs_prefix
+++ nvm_echo iojs
+++ command printf '%s\n' iojs
+++ nvm_node_prefix
+++ nvm_echo node
+++ command printf '%s\n' node
++ local VERSION
+++ nvm_strip_iojs_prefix system
+++ local NVM_IOJS_PREFIX
++++ nvm_iojs_prefix
++++ nvm_echo iojs
++++ command printf '%s\n' iojs
+++ NVM_IOJS_PREFIX=iojs
+++ '[' system = iojs ']'
+++ nvm_echo system
+++ command printf '%s\n' system
++ VERSION=system
++ nvm_version_greater_than_or_equal_to system 0
++ command awk 'BEGIN {
    if (ARGV[1] == "" || ARGV[2] == "") exit(1)
    split(ARGV[1], a, /\./);
    split(ARGV[2], b, /\./);
    for (i=1; i<=3; i++) {
      if (a[i] && a[i] !~ /^[0-9]+$/) exit(2);
      if (a[i] < b[i]) exit(3);
      else if (a[i] > b[i]) exit(0);
    }
    exit(0)
  }' system 0
++ nvm_rc_version
++ nvm use --silent
++ '[' 2 -lt 1 ']'
++ local DEFAULT_IFS
+++ nvm_echo t
+++ command printf '%s\n' t
+++ command tr t '\t'
++ DEFAULT_IFS=' 	
'
++ '[' hvxBc '!=' hvxBc ']'
++ '[' hvxBc '!=' hvxBc ']'
++ '[' -n /usr/bin/bash ']'
++ '[' hvxBc '!=' hvxBc ']'
++ '[' ' 	
' '!=' ' 	
' ']'
++ local i
++ for i in "$@"
++ case $i in
++ for i in "$@"
++ case $i in
++ local COMMAND
++ COMMAND=use
++ shift
++ local VERSION
++ local ADDITIONAL_PARAMETERS
++ case $COMMAND in
++ local PROVIDED_VERSION
++ local NVM_SILENT
++ local NVM_SILENT_ARG
++ local NVM_DELETE_PREFIX
++ NVM_DELETE_PREFIX=0
++ local NVM_LTS
++ local IS_VERSION_FROM_NVMRC
++ IS_VERSION_FROM_NVMRC=0
++ '[' 1 -ne 0 ']'
++ case "$1" in
++ NVM_SILENT=1
++ NVM_SILENT_ARG=--silent
++ shift
++ '[' 0 -ne 0 ']'
++ '[' -n '' ']'
++ '[' -z '' ']'
++ NVM_SILENT=1
++ nvm_rc_version
++ export NVM_RC_VERSION=
++ NVM_RC_VERSION=
++ local NVMRC_PATH
+++ nvm_find_nvmrc
+++ local dir
++++ nvm_find_up .nvmrc
++++ local path_
++++ path_=/home/runner/work/ize/ize
++++ '[' /home/runner/work/ize/ize '!=' '' ']'
++++ '[' /home/runner/work/ize/ize '!=' . ']'
++++ '[' '!' -f /home/runner/work/ize/ize/.nvmrc ']'
++++ nvm_echo /home/runner/work/ize/ize
++++ command printf '%s\n' /home/runner/work/ize/ize
+++ dir=/home/runner/work/ize/ize
+++ '[' -e /home/runner/work/ize/ize/.nvmrc ']'
+++ nvm_echo /home/runner/work/ize/ize/.nvmrc
+++ command printf '%s\n' /home/runner/work/ize/ize/.nvmrc
++ NVMRC_PATH=/home/runner/work/ize/ize/.nvmrc
++ '[' '!' -e /home/runner/work/ize/ize/.nvmrc ']'
+++ nvm_process_nvmrc /home/runner/work/ize/ize/.nvmrc
+++ local NVMRC_PATH=/home/runner/work/ize/ize/.nvmrc
+++ local lines
+++ local unpaired_line
++++ command sed 's/#.*//' /home/runner/work/ize/ize/.nvmrc
++++ nvm_grep -v '^$'
++++ GREP_OPTIONS=
++++ command grep -v '^$'
++++ command sed 's/^[[:space:]]*//;s/[[:space:]]*$//'
+++ lines=18
+++ '[' -z 18 ']'
+++ local keys=
+++ local values=
+++ IFS=
+++ read -r line
+++ '[' -z 18 ']'
+++ '[' -z 18 ']'
+++ case "$line" in
+++ false
+++ '[' -n '' ']'
+++ unpaired_line=18
+++ IFS=
+++ read -r line
+++ '[' -z 18 ']'
+++ nvm_echo 18
+++ command printf '%s\n' 18
++ NVM_RC_VERSION=18
++ '[' -z 18 ']'
++ '[' 1 -ne 1 ']'
++ '[' -n 18 ']'
++ PROVIDED_VERSION=18
++ IS_VERSION_FROM_NVMRC=1
+++ nvm_version 18
+++ local PATTERN
+++ PATTERN=18
+++ local VERSION
+++ '[' -z 18 ']'
+++ '[' 18 = current ']'
+++ local NVM_NODE_PREFIX
++++ nvm_node_prefix
++++ nvm_echo node
++++ command printf '%s\n' node
+++ NVM_NODE_PREFIX=node
+++ case "_${PATTERN}" in
++++ nvm_ls 18
++++ local PATTERN
++++ PATTERN=18
++++ local VERSIONS
++++ VERSIONS=
++++ '[' 18 = current ']'
++++ local NVM_IOJS_PREFIX
++++ command tail -1
+++++ nvm_iojs_prefix
+++++ nvm_echo iojs
+++++ command printf '%s\n' iojs
++++ NVM_IOJS_PREFIX=iojs
++++ local NVM_NODE_PREFIX
+++++ nvm_node_prefix
+++++ nvm_echo node
+++++ command printf '%s\n' node
++++ NVM_NODE_PREFIX=node
++++ local NVM_VERSION_DIR_IOJS
+++++ nvm_version_dir iojs
+++++ local NVM_WHICH_DIR
+++++ NVM_WHICH_DIR=iojs
+++++ '[' -z iojs ']'
+++++ '[' iojs = new ']'
+++++ '[' _iojs = _iojs ']'
+++++ nvm_echo /home/runner/.nvm/versions/io.js
+++++ command printf '%s\n' /home/runner/.nvm/versions/io.js
++++ NVM_VERSION_DIR_IOJS=/home/runner/.nvm/versions/io.js
++++ local NVM_VERSION_DIR_NEW
+++++ nvm_version_dir new
+++++ local NVM_WHICH_DIR
+++++ NVM_WHICH_DIR=new
+++++ '[' -z new ']'
+++++ '[' new = new ']'
+++++ nvm_echo /home/runner/.nvm/versions/node
+++++ command printf '%s\n' /home/runner/.nvm/versions/node
++++ NVM_VERSION_DIR_NEW=/home/runner/.nvm/versions/node
++++ local NVM_VERSION_DIR_OLD
+++++ nvm_version_dir old
+++++ local NVM_WHICH_DIR
+++++ NVM_WHICH_DIR=old
+++++ '[' -z old ']'
+++++ '[' old = new ']'
+++++ '[' _old = _iojs ']'
+++++ '[' _old = _old ']'
+++++ nvm_echo /home/runner/.nvm
+++++ command printf '%s\n' /home/runner/.nvm
++++ NVM_VERSION_DIR_OLD=/home/runner/.nvm
++++ case "${PATTERN}" in
++++ nvm_resolve_local_alias 18
++++ '[' -z 18 ']'
++++ local VERSION
++++ local EXIT_CODE
+++++ nvm_resolve_alias 18
+++++ '[' -z 18 ']'
+++++ local PATTERN
+++++ PATTERN=18
+++++ local ALIAS
+++++ ALIAS=18
+++++ local ALIAS_TEMP
+++++ local SEEN_ALIASES
+++++ SEEN_ALIASES=18
+++++ local NVM_ALIAS_INDEX
+++++ NVM_ALIAS_INDEX=1
+++++ true
++++++ nvm_alias 18
++++++ command head -n 1
++++++ command tail -n 1
+++++ ALIAS_TEMP=
+++++ '[' -z '' ']'
+++++ break
+++++ '[' -n 18 ']'
+++++ '[' _18 '!=' _18 ']'
+++++ nvm_validate_implicit_alias 18
+++++ return 2
++++ VERSION=
++++ EXIT_CODE=2
++++ '[' -z '' ']'
++++ return 2
+++++ nvm_ensure_version_prefix 18
+++++ local NVM_VERSION
++++++ nvm_strip_iojs_prefix 18
++++++ local NVM_IOJS_PREFIX
++++++ command sed -e 's/^\([0-9]\)/v\1/g'
+++++++ nvm_iojs_prefix
+++++++ nvm_echo iojs
+++++++ command printf '%s\n' iojs
++++++ NVM_IOJS_PREFIX=iojs
++++++ '[' 18 = iojs ']'
++++++ nvm_echo 18
++++++ command printf '%s\n' 18
+++++ NVM_VERSION=v18
+++++ nvm_is_iojs_version 18
+++++ case "${1-}" in
+++++ return 1
+++++ nvm_echo v18
+++++ command printf '%s\n' v18
++++ PATTERN=v18
++++ '[' v18 = N/A ']'
++++ local NVM_PATTERN_STARTS_WITH_V
++++ case $PATTERN in
++++ NVM_PATTERN_STARTS_WITH_V=true
++++ '[' true = true ']'
+++++ nvm_num_version_groups v18
+++++ local VERSION
+++++ VERSION=v18
+++++ VERSION=18
+++++ VERSION=18
+++++ '[' -z 18 ']'
+++++ local NVM_NUM_DOTS
++++++ nvm_echo 18
++++++ command printf '%s\n' 18
++++++ command sed -e 's/[^\.]//g'
+++++ NVM_NUM_DOTS=
+++++ local NVM_NUM_GROUPS
+++++ NVM_NUM_GROUPS=.
+++++ nvm_echo 1
+++++ command printf '%s\n' 1
++++ '[' _1 = _3 ']'
++++ case "${PATTERN}" in
++++ local NUM_VERSION_GROUPS
+++++ nvm_num_version_groups v18
+++++ local VERSION
+++++ VERSION=v18
+++++ VERSION=18
+++++ VERSION=18
+++++ '[' -z 18 ']'
+++++ local NVM_NUM_DOTS
++++++ nvm_echo 18
++++++ command printf '%s\n' 18
++++++ command sed -e 's/[^\.]//g'
+++++ NVM_NUM_DOTS=
+++++ local NVM_NUM_GROUPS
+++++ NVM_NUM_GROUPS=.
+++++ nvm_echo 1
+++++ command printf '%s\n' 1
++++ NUM_VERSION_GROUPS=1
++++ '[' 1 = 2 ']'
++++ '[' 1 = 1 ']'
++++ PATTERN=v18.
++++ nvm_is_zsh
++++ '[' -n '' ']'
++++ nvm_is_zsh
++++ '[' -n '' ']'
++++ local NVM_DIRS_TO_SEARCH1
++++ NVM_DIRS_TO_SEARCH1=
++++ local NVM_DIRS_TO_SEARCH2
++++ NVM_DIRS_TO_SEARCH2=
++++ local NVM_DIRS_TO_SEARCH3
++++ NVM_DIRS_TO_SEARCH3=
++++ local NVM_ADD_SYSTEM
++++ NVM_ADD_SYSTEM=false
++++ nvm_is_iojs_version v18.
++++ case "${1-}" in
++++ return 1
++++ '[' v18. = node- ']'
++++ NVM_DIRS_TO_SEARCH1=/home/runner/.nvm
++++ NVM_DIRS_TO_SEARCH2=/home/runner/.nvm/versions/node
++++ NVM_DIRS_TO_SEARCH3=/home/runner/.nvm/versions/io.js
++++ nvm_has_system_iojs
+++++ nvm deactivate
+++++ command -v iojs
++++ '[' '' '!=' '' ']'
++++ nvm_has_system_node
+++++ nvm deactivate
+++++ command -v node
++++ '[' /usr/local/bin/node '!=' '' ']'
++++ NVM_ADD_SYSTEM=true
++++ '[' -d /home/runner/.nvm ']'
++++ command ls -1qA /home/runner/.nvm
++++ nvm_grep -q .
++++ GREP_OPTIONS=
++++ command grep -q .
++++ '[' -d /home/runner/.nvm/versions/node ']'
++++ NVM_DIRS_TO_SEARCH2=/home/runner/.nvm
++++ '[' -d /home/runner/.nvm/versions/io.js ']'
++++ NVM_DIRS_TO_SEARCH3=/home/runner/.nvm
++++ local SEARCH_PATTERN
++++ '[' -z v18. ']'
+++++ nvm_echo v18.
+++++ command printf '%s\n' v18.
+++++ command sed 's#\.#\\\.#g;'
++++ SEARCH_PATTERN='v18\.'
++++ '[' -n /home/runner/.nvm/home/runner/.nvm/home/runner/.nvm ']'
+++++ command find /home/runner/.nvm/CODE_OF_CONDUCT.md /home/runner/.nvm/CONTRIBUTING.md /home/runner/.nvm/Dockerfile /home/runner/.nvm/GOVERNANCE.md /home/runner/.nvm/LICENSE.md /home/runner/.nvm/Makefile /home/runner/.nvm/PROJECT_CHARTER.md /home/runner/.nvm/README.md /home/runner/.nvm/ROADMAP.md /home/runner/.nvm/alias /home/runner/.nvm/bash_completion /home/runner/.nvm/install.sh /home/runner/.nvm/nvm-exec /home/runner/.nvm/nvm.sh /home/runner/.nvm/package.json /home/runner/.nvm/rename_test.sh /home/runner/.nvm/test /home/runner/.nvm/update_test_mocks.sh /home/runner/.nvm/CODE_OF_CONDUCT.md /home/runner/.nvm/CONTRIBUTING.md /home/runner/.nvm/Dockerfile /home/runner/.nvm/GOVERNANCE.md /home/runner/.nvm/LICENSE.md /home/runner/.nvm/Makefile /home/runner/.nvm/PROJECT_CHARTER.md /home/runner/.nvm/README.md /home/runner/.nvm/ROADMAP.md /home/runner/.nvm/alias /home/runner/.nvm/bash_completion /home/runner/.nvm/install.sh /home/runner/.nvm/nvm-exec /home/runner/.nvm/nvm.sh /home/runner/.nvm/package.json /home/runner/.nvm/rename_test.sh /home/runner/.nvm/test /home/runner/.nvm/update_test_mocks.sh /home/runner/.nvm/CODE_OF_CONDUCT.md /home/runner/.nvm/CONTRIBUTING.md /home/runner/.nvm/Dockerfile /home/runner/.nvm/GOVERNANCE.md /home/runner/.nvm/LICENSE.md /home/runner/.nvm/Makefile /home/runner/.nvm/PROJECT_CHARTER.md /home/runner/.nvm/README.md /home/runner/.nvm/ROADMAP.md /home/runner/.nvm/alias /home/runner/.nvm/bash_completion /home/runner/.nvm/install.sh /home/runner/.nvm/nvm-exec /home/runner/.nvm/nvm.sh /home/runner/.nvm/package.json /home/runner/.nvm/rename_test.sh /home/runner/.nvm/test /home/runner/.nvm/update_test_mocks.sh -name . -o -type d -prune -o -path 'v18.*'
+++++ command sed -e '
            s#/home/runner/.nvm/versions/io.js/#versions/iojs/#;
            s#^/home/runner/.nvm/##;
            \#^[^v]# d;
            \#^versions$# d;
            s#^versions/##;
            s#^v#node/v#;
            \#v18\.# !d;
          ' -e 's#^\([^/]\{1,\}\)/\(.*\)$#\2.\1#;'
+++++ command sed -e 's#\(.*\)\.\([^\.]\{1,\}\)$#\2-\1#;' -e 's#^node-##;'
+++++ command sort -t. -u -k 1.2,1n -k 2,2n -k 3,3n
++++ VERSIONS=
++++ '[' true = true ']'
++++ '[' -z v18. ']'
++++ '[' v18. = v ']'
++++ '[' v18. = system ']'
++++ '[' -z '' ']'
++++ nvm_echo N/A
++++ command printf '%s\n' N/A
++++ return 3
+++ VERSION=N/A
+++ '[' -z N/A ']'
+++ '[' _N/A = _N/A ']'
+++ nvm_echo N/A
+++ command printf '%s\n' N/A
+++ return 3
++ VERSION=N/A
++ unset NVM_RC_VERSION
++ '[' -z N/A ']'
++ '[' -z N/A ']'
++ '[' 0 -eq 1 ']'
++ '[' _N/A = _system ']'
++ '[' _N/A = _∞ ']'
++ '[' N/A = N/A ']'
++ '[' 1 -ne 1 ']'
++ return 3

Edit: updated the run to match the install

nvm_is_iojs_version 18

@ljharb Does it mean it uses iojs as default (unlike node) or am I misreading the debug?

@ljharb
Copy link
Member

ljharb commented Aug 10, 2024

ok, so the default options in that workflow are ehB, which means there's some change in v0.4.0 that breaks with set -e usage. Since it's set with no action from you, telling you that it's a bad idea to set that option does no good :-) so I'll see if I can figure out how to cover this scenario.

The github action workflow was and will be very helpful here, both for repro, investigation, and later for a regression test.

@ljharb
Copy link
Member

ljharb commented Aug 10, 2024

@AutomationD yeah, you're misreading it - that's just a predicate to determine if v18 is an iojs version (which it's not, ofc).

@AutomationD
Copy link
Author

ok, so the default options in that workflow are ehB, which means there's some change in v0.4.0 that breaks with set -e usage. Since it's set with no action from you, telling you that it's a bad idea to set that option does no good :-) so I'll see if I can figure out how to cover this scenario.

The github action workflow was and will be very helpful here, both for repro, investigation, and later for a regression test.

Great find, thanks for looking into it!

At this point I'll be locking my nvm workflows and a wrapper using nvm to version 0.39.7. But if any of my tests show any answers to your question I'll report back.

@ljharb
Copy link
Member

ljharb commented Aug 10, 2024

ok, some bisecting suggests the issue was introduced in #2869: https://github.com/ljharb/ize/actions/runs/10328344009

I've got a fix; I'll adapt the workflows into a regression test tomorrow soon, and then I can land and release this.

@Skenvy
Copy link

Skenvy commented Aug 12, 2024

I ran into this issue and spent a while narrowing it down to the nvm version before finding this thread, but here's my regression workflow that shows some difference between v0.39.7 and v0.40.0 was the culprit (testing all between the current version in use on the runner, and the previous version in use by the runner, v0.39.5)

name: Test NVMs NVM_DIR on ubuntu-latest
on:
  workflow_dispatch:
defaults:
  run:
    shell: bash
env:
  UNAUTO_NODE_VERSION: v18.18.2 # "NODE_VERSION" is read by the nvm install script.
  SETX: "false"
jobs:
  nvmrc-present-older-nvm:
    strategy:
      fail-fast: false
      matrix:
        nvm-version: ['v0.39.5', 'v0.39.6', 'v0.39.7', 'v0.40.0']
    runs-on: ubuntu-latest
    steps:
    - run: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/${{ matrix.nvm-version }}/install.sh | bash
    - run: echo "$UNAUTO_NODE_VERSION" > .nvmrc
    - if: env.SETX == 'true'
      run: source <(echo "set -x"; cat $NVM_DIR/nvm.sh; echo "set +x") && nvm install $(cat .nvmrc)
    - if: env.SETX != 'true'
      run: source $NVM_DIR/nvm.sh && nvm install $(cat .nvmrc)
  nvmrc-present-default-nvm: # v0.40.0 atm
    runs-on: ubuntu-latest
    steps:
    - run: echo "$UNAUTO_NODE_VERSION" > .nvmrc
    - if: env.SETX == 'true'
      run: source <(echo "set -x"; cat $NVM_DIR/nvm.sh; echo "set +x") && nvm install $(cat .nvmrc)
    - if: env.SETX != 'true'
      run: source $NVM_DIR/nvm.sh && nvm install $(cat .nvmrc)
  nvmrc-absent-default-nvm: # v0.40.0 atm
    runs-on: ubuntu-latest
    steps:
    - run: source $NVM_DIR/nvm.sh && nvm install $UNAUTO_NODE_VERSION

@AutomationD
Copy link
Author

I ran into this issue and spent a while narrowing it down to the nvm version before finding this thread, but here's my regression workflow that shows some difference between v0.39.7 and v0.40.0 was the culprit (testing all between the current version in use on the runner, and the previous version in use by the runner, v0.39.5)

name: Test NVMs NVM_DIR on ubuntu-latest
on:
  workflow_dispatch:
defaults:
  run:
    shell: bash
env:
  UNAUTO_NODE_VERSION: v18.18.2 # "NODE_VERSION" is read by the nvm install script.
  SETX: "false"
jobs:
  nvmrc-present-older-nvm:
    strategy:
      fail-fast: false
      matrix:
        nvm-version: ['v0.39.5', 'v0.39.6', 'v0.39.7', 'v0.40.0']
    runs-on: ubuntu-latest
    steps:
    - run: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/${{ matrix.nvm-version }}/install.sh | bash
    - run: echo "$UNAUTO_NODE_VERSION" > .nvmrc
    - if: env.SETX == 'true'
      run: source <(echo "set -x"; cat $NVM_DIR/nvm.sh; echo "set +x") && nvm install $(cat .nvmrc)
    - if: env.SETX != 'true'
      run: source $NVM_DIR/nvm.sh && nvm install $(cat .nvmrc)
  nvmrc-present-default-nvm: # v0.40.0 atm
    runs-on: ubuntu-latest
    steps:
    - run: echo "$UNAUTO_NODE_VERSION" > .nvmrc
    - if: env.SETX == 'true'
      run: source <(echo "set -x"; cat $NVM_DIR/nvm.sh; echo "set +x") && nvm install $(cat .nvmrc)
    - if: env.SETX != 'true'
      run: source $NVM_DIR/nvm.sh && nvm install $(cat .nvmrc)
  nvmrc-absent-default-nvm: # v0.40.0 atm
    runs-on: ubuntu-latest
    steps:
    - run: source $NVM_DIR/nvm.sh && nvm install $UNAUTO_NODE_VERSION

Welcome to the family 🤗

Hopefully @ljharb will release a fix soon.

@Skenvy
Copy link

Skenvy commented Aug 12, 2024

Prior to some fix that may take some time to percolate onto the runner (and not wanting to frob the installed version), besides swallowing any other arbitrary error, is temporarily renaming the .nvmrc the only solution or is there some way to manipulate it during sourcing that prevents that check?

@AutomationD
Copy link
Author

Prior to some fix that may take some time to percolate onto the runner (and not wanting to frob the installed version), besides swallowing any other arbitrary error, is temporarily renaming the .nvmrc the only solution or is there some way to manipulate it during sourcing that prevents that check?

The only workaround I know is downgrading to v0.39.7 before calling nvm via something like:

bash -c "curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash"

@ljharb
Copy link
Member

ljharb commented Aug 13, 2024

The trivial workaround in the meantime is set +e before sourcing nvm.sh.

@levischuckeats
Copy link

levischuckeats commented Aug 15, 2024

My solution was to remove NVM from ~/.bash_profile, since our workflows involve adding helper functions which are loaded and used in later workflow steps. 😢

Exit code 3 was not great.

@AutomationD
Copy link
Author

My solution was to remove NVM from ~/.bash_profile, since our workflows involve adding helper functions which are loaded and used in later workflow steps. 😢

Exit code 3 was not great.

How did you use nvm without having it in the bash profile though?

@levischuckeats
Copy link

How did you use nvm without having it in the bash profile though?

NVM got installed through a third party action at the beginning, such as aws-actions/configure-aws-credentials@master (I think this is the one, it mentions a node install in the output)

The rest of our actions do not require node or nvm and do not explicitly install nvm.
However, our actions do use the set -e flag prior to running source $HOME/.bash_profile. We use this to stay on top of any fragile bash scripting by the platform team in github actions and circle CI.

This issue should affect anyone doing something similar: setting -e, adding to ~/.bash_profile, and then sourcing the bash_profile, where a prior action happens to install nvm.

@ljharb
Copy link
Member

ljharb commented Aug 15, 2024

Unfortunately set -e is itself fragile, and shouldn't be set, but is still very widely used and erroneously understood.

I was able to create solid regression tests, but they exposed they my fix wasn't complete, and I'm still working on that fix.

thisconnect added a commit to thisconnect/bitbox-wallet-app that referenced this issue Aug 19, 2024
Downgrading to nvm v0.39.7, see this issue:
- nvm-sh/nvm#3405

Homebrew installation is not supported, see:
- https://github.com/nvm-sh/nvm?tab=readme-ov-file#important-notes
thisconnect added a commit to thisconnect/bitbox-wallet-app that referenced this issue Aug 19, 2024
Downgrading to nvm v0.39.7, see this issue:
- nvm-sh/nvm#3405

Homebrew installation is not supported, see:
- https://github.com/nvm-sh/nvm?tab=readme-ov-file#important-notes
@ljharb ljharb closed this as completed in c31a867 Aug 20, 2024
@ljharb
Copy link
Member

ljharb commented Aug 20, 2024

got it! I'm going to try to squeeze in one more bugfix, and I'll have a patch release out tomorrow.

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

5 participants