@@ -180,6 +180,27 @@ function _lint {
180180 chmod +x .codebuild/scripts/lint_pr.sh && ./.codebuild/scripts/lint_pr.sh
181181}
182182
183+ function _setupNodeVersion {
184+ local version=$1 # Version number passed as an argument
185+
186+ echo " Installing NVM and setting Node.js version to $version "
187+
188+ # Install NVM
189+ curl -o - https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
190+
191+ # Load NVM
192+ export NVM_DIR=" $HOME /.nvm"
193+ [ -s " $NVM_DIR /nvm.sh" ] && \. " $NVM_DIR /nvm.sh"
194+
195+ # Install and use the specified Node.js version
196+ nvm install " $version "
197+ nvm use " $version "
198+
199+ # Verify the Node.js version in use
200+ echo " Node.js version in use:"
201+ node -v
202+ }
203+
183204function _publishToLocalRegistry {
184205 echo " Publish To Local Registry"
185206 loadCacheFromLinuxBuildJob
@@ -274,6 +295,8 @@ function _setupE2ETestsWindows {
274295
275296function _setupGen2E2ETestsLinux {
276297 echo " Setup Gen2 E2E Tests Linux"
298+ # Set Node.js version to v18.20.6 because execa requires later version
299+ _setupNodeVersion v18.20.4
277300 loadCacheFromLinuxBuildJob
278301 loadCache verdaccio-cache $CODEBUILD_SRC_DIR /../verdaccio-cache
279302 _loadTestAccountCredentials
@@ -282,6 +305,8 @@ function _setupGen2E2ETestsLinux {
282305
283306function _setupGen2E2ETestsWindows {
284307 echo " Setup Gen2 E2E Tests Windows"
308+ # Set Node.js version to v18.20.6 because execa requires later version
309+ _setupNodeVersion v18.20.4
285310 loadCacheFromWindowsBuildJob
286311 loadCache verdaccio-cache $CODEBUILD_SRC_DIR /../verdaccio-cache windows
287312 _loadTestAccountCredentials
0 commit comments