From 44288bc2f0391e2e3ddd3cf1745835e7a449a4d2 Mon Sep 17 00:00:00 2001 From: Daniel Bankhead Date: Wed, 20 Nov 2024 17:13:48 -0800 Subject: [PATCH] chore: fix `npm` for samples tests --- synthtool/gcp/templates/node_library/.kokoro/samples-test.sh | 4 +++- tests/fixtures/nodejs_mono_repo_esm/.kokoro/samples-test.sh | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/synthtool/gcp/templates/node_library/.kokoro/samples-test.sh b/synthtool/gcp/templates/node_library/.kokoro/samples-test.sh index 59098966f..e07413af6 100755 --- a/synthtool/gcp/templates/node_library/.kokoro/samples-test.sh +++ b/synthtool/gcp/templates/node_library/.kokoro/samples-test.sh @@ -16,7 +16,9 @@ set -eo pipefail -export NPM_CONFIG_PREFIX=${HOME}/.npm-global +# Ensure the npm global directory is writable, otherwise rebuild `npm` +mkdir -p $NPM_CONFIG_PREFIX +npm config -g ls || npm i -g npm@`npm --version` # Setup service account credentials. export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/secret_manager/long-door-651-kokoro-system-test-service-account diff --git a/tests/fixtures/nodejs_mono_repo_esm/.kokoro/samples-test.sh b/tests/fixtures/nodejs_mono_repo_esm/.kokoro/samples-test.sh index 950f84834..c6551d57d 100644 --- a/tests/fixtures/nodejs_mono_repo_esm/.kokoro/samples-test.sh +++ b/tests/fixtures/nodejs_mono_repo_esm/.kokoro/samples-test.sh @@ -16,7 +16,9 @@ set -eo pipefail -export NPM_CONFIG_PREFIX=${HOME}/.npm-global +# Ensure the npm global directory is writable, otherwise rebuild `npm` +mkdir -p $NPM_CONFIG_PREFIX +npm config -g ls || npm i -g npm@`npm --version` # Setup service account credentials. export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/service-account.json