|
26 | 26 | sed -i "$HOME/.npmrc" -e 's/^prefix=.*$//' |
27 | 27 | fi |
28 | 28 | fi |
29 | | - export NVM_DIR="$BASEDIR/.nvm" |
30 | | - mkdir -p "${NVM_DIR}" |
31 | | - |
32 | | - curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash |
33 | | - |
34 | | - echo "Setting NVM environment home: $NVM_DIR" |
35 | | - [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" |
36 | | - [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" |
37 | | - |
38 | | - set +x # nvm is very verbose |
39 | | - |
40 | | - # A few distros where pre-built node20 does not work out of the box and hence |
41 | | - # needs to be built from source |
42 | | - if [[ "${DISTRO_ID}" =~ ^(amazon2-|rhel7|ubuntu18|suse12) ]] && [[ "$NODE_JS_VERSION" =~ ^20 ]]; |
43 | | - then |
44 | | - NODE_JS_SOURCE_VERSION="$NODE_JS_VERSION" |
45 | | - if echo $NODE_JS_VERSION | grep -q ^20 ; then |
46 | | - # Node.js 20.11.1 is the last 20.x that builds out of the box on RHEL7 |
47 | | - # https://github.com/nodejs/node/issues/52223 |
48 | | - NODE_JS_SOURCE_VERSION=20.11.1 |
49 | | - fi |
50 | | - env NODE_JS_VERSION="$NODE_JS_SOURCE_VERSION" bash "$BASEDIR/install-node-source.sh" |
51 | | - nvm use $NODE_JS_SOURCE_VERSION |
52 | | - else |
53 | | - echo nvm install --no-progress $NODE_JS_VERSION && nvm alias default $NODE_JS_VERSION |
54 | | - nvm install --no-progress $NODE_JS_VERSION |
55 | | - nvm alias default $NODE_JS_VERSION |
56 | | - nvm use $NODE_JS_VERSION |
57 | | - fi |
58 | | - set -x |
59 | | - |
60 | | - if env PATH="/opt/chefdk/gitbin:$PATH" git --version | grep -q 'git version 1.'; then |
61 | | - (cd "$BASEDIR" && |
62 | | - curl -sSfL https://github.com/git/git/archive/refs/tags/v2.31.1.tar.gz | tar -xvz && |
63 | | - mv git-2.31.1 git-2 && |
64 | | - cd git-2 && |
65 | | - make -j8 NO_EXPAT=1) |
66 | | - fi |
67 | 29 |
|
68 | 30 | npm cache clear --force || true # Try to work around `Cannot read property 'pickAlgorithm' of null` errors in CI |
69 | | - # Started observing CI failures on RHEL 7.2 (s390x) for installing npm, all |
70 | | - # related to network issues hence adding a retry with backoff here. |
71 | | - bash "$BASEDIR/retry-with-backoff.sh" npm i -g npm@$NPM_VERSION |
72 | 31 | fi |
73 | 32 |
|
74 | 33 | . "$BASEDIR/setup-env.sh" |
0 commit comments