microsoft/typescript-go · error · Error
Published platform package ${npmPackageName}@${version} did
Error message
Published platform package ${npmPackageName}@${version} did not contain a lib directory. What it means
After `npm pack` downloads and tar extracts a published platform package into a staging directory, getPublishedPlatformPackageLibDir expects a `lib/` directory at the destination (the native binary lives there). If the extracted tarball has no lib/, the package content is not what the VSIX packaging needs — wrong package layout, wrong version fetched, or a malformed publication — so it throws before returning the path.
Source
Thrown at Herebyfile.mjs:2292
throw new Error(`package-lock.json does not contain ${npmPackageName}; run npm install.`);
}
if (lockEntry.version !== version) {
throw new Error(`package-lock.json has ${npmPackageName}@${lockEntry.version}, but ${publishedTypeScriptAliasPackageName} depends on ${version}.`);
}
if (!lockEntry.resolved || typeof lockEntry.resolved !== "string") {
throw new Error(`package-lock.json entry for ${npmPackageName}@${version} does not contain a tarball URL.`);
}
console.log(`Fetching ${npmPackageName}@${version} with npm.`);
const { stdout } = await $pipe({ cwd: tarballDestination, env: releasePackageEnv })`npm pack --json ${npmPackageName}@${version}`;
const [packed] = JSON.parse(stdout);
if (!packed.filename || typeof packed.filename !== "string") {
throw new Error(`npm pack ${npmPackageName}@${version} did not return a filename.`);
}
await tar.x({ file: path.join(tarballDestination, packed.filename), cwd: dest, strip: 1 });
if (!fs.existsSync(lib)) {
throw new Error(`Published platform package ${npmPackageName}@${version} did not contain a lib directory.`);
}
return lib;
}
async function runPackVsixExtensions() {
await rimraf(builtVsix);
await fs.promises.mkdir(builtVsix, { recursive: true });
if (usePublishedPlatformPackagesForVsix) {
checkPublishedPlatformPackagesForVsix();
publishedPlatformPackageLibDirs.clear();
await rimraf(builtPublishedPlatformPackages);
}
const platforms = getPlatforms();
const extensions = platforms.flatMap(({ npmDir, npmPackageName, extensions }) => extensions.map(e => ({ npmDir, npmPackageName, ...e })));
if (!extensions.length) {
console.log("No VSIX targets configured; skipping extension packaging.");
View on GitHub (pinned to 1bcfa18d79)
Solutions
- Inspect the tarball: `tar -tzf <tarballs>/<file>.tgz | head` and confirm `package/lib/` is present
- Verify the version being fetched actually matches the intended published platform package (alias optionalDependencies vs lock)
- Clear the staging dir (`built/published-packages` area and its tarballs) and retry so a fresh, complete extraction happens; if the published package is genuinely malformed, release a fixed platform package
Defensive patterns
Strategy: validation
Validate before calling
// Inspect the tarball layout before extracting
import { execSync } from "node:child_process";
const listing = execSync(`tar -tzf ${tgzPath}`).toString();
if (!/^package\/lib\//m.test(listing)) {
throw new Error(`${tgzPath} has no package/lib/ — wrong or malformed platform package`);
} Prevention
- Verify tarball contents (tar -tzf) when pulling in a new platform-package version
- Clear the staging/tarballs cache between release runs so stale extractions can't linger
When it happens
Trigger: The tarball fetched via npm pack for `<npmPackageName>@<version>` extracts without a top-level lib/ directory — e.g. the published platform package of that version used a different layout, the version string resolved to a non-platform package, or the tarball was damaged/replaced.
Common situations: Pointing the alias at a version whose packages weren't built by this pipeline; a republished/overwritten tarball; a proxy serving a cached substitute; partial extraction interrupted previously leaving a bad cached dir.
Related errors
- ${publishedTypeScriptAliasPackageName} should alias the type
- ${publishedTypeScriptAliasPackageName} package.json did not
- ${publishedTypeScriptAliasPackageName} does not depend on ${
- Found external imports in .d.ts files:\n${importErrors.map(e
- ${publishedTypeScriptAliasPackageName} package.json did not
AI-assisted analysis of microsoft/typescript-go@1bcfa18d79 (2026-08-16).
Data as JSON: /api/errors/01cc945bd19d5339.
Report an issue: GitHub.