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
- Run `npm install` at the repository root, then re-run the hereby task
- If install fails, check registry reachability/.npmrc and the `@typescript/bundled-typescript` entry in package.json
- 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
- Make `npm install` the first step of every fresh clone/worktree setup
- Fail fast in scripts with an explicit dependency check before invoking hereby release tasks
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
- ${publishedTypeScriptAliasPackageName} should alias the type
- package-lock.json does not contain ${npmPackageName}; run np
- Found external imports in .d.ts files:\n${importErrors.map(e
- ${publishedTypeScriptAliasPackageName} package.json did not
- ${publishedTypeScriptAliasPackageName} package.json did not
AI-assisted analysis of microsoft/typescript-go@1bcfa18d79 (2026-08-16).
Data as JSON: /api/errors/7acb57105aa4f347.
Report an issue: GitHub.