microsoft/typescript-go · error · Error
${publishedTypeScriptAliasPackageName} package.json did not
Error message
${publishedTypeScriptAliasPackageName} package.json did not contain a version. What it means
Second validation inside getPublishedTypeScriptPackageJson: after confirming the resolved `@typescript/bundled-typescript` package.json has `name: "typescript"`, it requires a string `version` field because the whole published-platform flow (VSIX packaging against published platform packages) keys every download off that version. A missing or non-string version makes the alias unusable, so it throws.
Source
Thrown at Herebyfile.mjs:2210
});
/** @type {Map<string, Promise<string>>} */
const publishedPlatformPackageLibDirs = new Map();
const getPublishedTypeScriptPackageJson = memoize(() => {
const candidates = [
path.join(extensionDir, "node_modules", publishedTypeScriptAliasPackageName, "package.json"),
path.join(__dirname, "node_modules", publishedTypeScriptAliasPackageName, "package.json"),
];
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;
View on GitHub (pinned to 1bcfa18d79)
Solutions
- Open the candidate `@typescript/bundled-typescript/package.json` and check whether `version` exists and is a string
- Remove the corrupted directory and re-run `npm install` at the repo root to restore a clean copy
- If it recurs, verify registry configuration (.npmrc) and disk state (no ENOSPC during install)
Defensive patterns
Strategy: validation
Validate before calling
const pj = JSON.parse(fs.readFileSync(aliasPath, "utf8"));
if (typeof pj.version !== "string" || pj.version.length === 0) {
throw new Error(`${aliasPath} is malformed (no version) — reinstall`);
} Prevention
- Treat a package.json missing `version` as a corrupted install: delete and reinstall rather than patch it
- Run `npm ci` in CI so installs are atomic and lockfile-exact
When it happens
Trigger: The alias package.json parses as JSON but has no `version` field (or a non-string one) — e.g. a truncated/partially written file from an interrupted install, a hand-edited package.json, or a malformed tarball from a registry mirror.
Common situations: Interrupted npm install leaving a truncated package.json; someone stripped fields while debugging node_modules; a private registry proxy serving a rewritten package.json.
Related errors
- ${publishedTypeScriptAliasPackageName} should alias the type
- ${publishedTypeScriptAliasPackageName} package.json did not
- Found external imports in .d.ts files:\n${importErrors.map(e
- Could not find ${publishedTypeScriptAliasPackageName}; run n
- ${publishedTypeScriptAliasPackageName} does not depend on ${
AI-assisted analysis of microsoft/typescript-go@1bcfa18d79 (2026-08-16).
Data as JSON: /api/errors/c8d888b883f130d0.
Report an issue: GitHub.