diff --git a/ng-dev/misc/sync-module-bazel/sync-module-bazel.ts b/ng-dev/misc/sync-module-bazel/sync-module-bazel.ts index 0eedc9563..ebe6f2611 100644 --- a/ng-dev/misc/sync-module-bazel/sync-module-bazel.ts +++ b/ng-dev/misc/sync-module-bazel/sync-module-bazel.ts @@ -139,6 +139,12 @@ async function processNodeToolchainArgs( return args; } + const validatedVersion = semver.valid(effectiveVersion); + if (!validatedVersion) { + throw new Error('Invalid Node.js version: ' + effectiveVersion); + } + effectiveVersion = validatedVersion; + Log.info(`Resolving Node.js repositories for v${effectiveVersion}...`); const repositories = await getNodeJsRepositories(effectiveVersion); const lines = repositories.map(({filename, sha, type}) => {