microsoft/typescript-go · error · Error

Could not find ${publishedTypeScriptAliasPackageName}; run n

Error message

Could not find ${publishedTypeScriptAliasPackageName}; run npm install first.

What it means

Final fallback of getPublishedTypeScriptPackageJson: it probes two candidate paths — `_extension/node_modules/@typescript/bundled-typescript/package.json` and `<repo>/node_modules/@typescript/bundled-typescript/package.json` — and if neither exists, throws with the actionable hint to run npm install. Everything downstream (published version checks, platform tarball fetching) needs this alias package present.

Source

Thrown at Herebyfile.mjs:2219

    ];

    for (const candidate of candidates) {
        if (fs.existsSync(candidate)) {
            const packageJson = JSON.parse(fs.readFileSync(candidate, "utf8"));
            if (packageJson.name !== "typescript") {
                throw new Error(`${publishedTypeScriptAliasPackageName} should alias the typescript package, but found ${packageJson.name}.`);
            }
            if (!packageJson.version || typeof packageJson.version !== "string") {
                throw new Error(`${publishedTypeScriptAliasPackageName} package.json did not contain a version.`);
            }
            if (!packageJson.optionalDependencies || typeof packageJson.optionalDependencies !== "object") {
                throw new Error(`${publishedTypeScriptAliasPackageName} package.json did not contain platform optionalDependencies.`);
            }
            return packageJson;
        }
    }

    throw new Error(`Could not find ${publishedTypeScriptAliasPackageName}; run npm install first.`);
});

function getPublishedTypeScriptVersion() {
    const version = getPublishedTypeScriptPackageJson().version;
    const expectedVersion = getVersion();
    if (usePublishedPlatformPackagesForVsix && version !== expectedVersion) {
        throw new Error(`usePublishedPlatformPackagesForVsix requires ${publishedTypeScriptAliasPackageName}'s installed version (${version}) to match release version ${expectedVersion}.`);
    }
    return version;
}

function checkPublishedPlatformPackagesForVsix() {
    if (!options.forRelease) {
        throw new Error("usePublishedPlatformPackagesForVsix requires forRelease");
    }
    getPublishedTypeScriptVersion();
}

View on GitHub (pinned to 1bcfa18d79)

Solutions

  1. Run `npm install` at the repository root, then re-run the hereby task
  2. If install fails, check registry reachability/.npmrc and the `@typescript/bundled-typescript` entry in package.json
  3. Verify one of the two candidate paths now exists before retrying

Example fix

# before
npx hereby native-preview:release --forRelease --setPrerelease=dev.1.0  # throws

# after
npm install && npx hereby native-preview:release --forRelease --setPrerelease=dev.1.0
Defensive patterns

Strategy: validation

Validate before calling

const candidates = [
  path.join(extensionDir, "node_modules", "@typescript/bundled-typescript", "package.json"),
  path.join(repoRoot, "node_modules", "@typescript/bundled-typescript", "package.json"),
];
if (!candidates.some(fs.existsSync)) {
  throw new Error("Dependencies not installed — run npm install first");
}

Prevention

When it happens

Trigger: Running a VSIX/native-preview task that uses published platform packages (e.g. `native-preview:release` with usePublishedPlatformPackagesForVsix) on a fresh clone or after `npm ci`/clean, before dependencies are installed.

Common situations: Fresh clone without `npm install`; a clean step removed node_modules; CI job caching node_modules incorrectly; running the task from a worktree where the root install was never done.

Related errors


AI-assisted analysis of microsoft/typescript-go@1bcfa18d79 (2026-08-16). Data as JSON: /api/errors/7acb57105aa4f347. Report an issue: GitHub.