{"record":{"id":"7acb57105aa4f347","repo":"microsoft/typescript-go","slug":"could-not-find-publishedtypescriptaliaspackagena","errorCode":null,"errorMessage":"Could not find ${publishedTypeScriptAliasPackageName}; run npm install first.","messagePattern":"Could not find (.+?); run npm install first\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"Herebyfile.mjs","lineNumber":2219,"sourceCode":"    ];\r\n\r\n    for (const candidate of candidates) {\r\n        if (fs.existsSync(candidate)) {\r\n            const packageJson = JSON.parse(fs.readFileSync(candidate, \"utf8\"));\r\n            if (packageJson.name !== \"typescript\") {\r\n                throw new Error(`${publishedTypeScriptAliasPackageName} should alias the typescript package, but found ${packageJson.name}.`);\r\n            }\r\n            if (!packageJson.version || typeof packageJson.version !== \"string\") {\r\n                throw new Error(`${publishedTypeScriptAliasPackageName} package.json did not contain a version.`);\r\n            }\r\n            if (!packageJson.optionalDependencies || typeof packageJson.optionalDependencies !== \"object\") {\r\n                throw new Error(`${publishedTypeScriptAliasPackageName} package.json did not contain platform optionalDependencies.`);\r\n            }\r\n            return packageJson;\r\n        }\r\n    }\r\n\r\n    throw new Error(`Could not find ${publishedTypeScriptAliasPackageName}; run npm install first.`);\r\n});\r\n\r\nfunction getPublishedTypeScriptVersion() {\r\n    const version = getPublishedTypeScriptPackageJson().version;\r\n    const expectedVersion = getVersion();\r\n    if (usePublishedPlatformPackagesForVsix && version !== expectedVersion) {\r\n        throw new Error(`usePublishedPlatformPackagesForVsix requires ${publishedTypeScriptAliasPackageName}'s installed version (${version}) to match release version ${expectedVersion}.`);\r\n    }\r\n    return version;\r\n}\r\n\r\nfunction checkPublishedPlatformPackagesForVsix() {\r\n    if (!options.forRelease) {\r\n        throw new Error(\"usePublishedPlatformPackagesForVsix requires forRelease\");\r\n    }\r\n    getPublishedTypeScriptVersion();\r\n}\r\n\r","sourceCodeStart":2201,"sourceCodeEnd":2237,"githubUrl":"https://github.com/microsoft/typescript-go/blob/1bcfa18d79a3be41772223d5c05dfe4480e614ff/Herebyfile.mjs#L2201-L2237","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\nnpx hereby native-preview:release --forRelease --setPrerelease=dev.1.0  # throws\n\n# after\nnpm install && npx hereby native-preview:release --forRelease --setPrerelease=dev.1.0","handlingStrategy":"validation","validationCode":"const candidates = [\n  path.join(extensionDir, \"node_modules\", \"@typescript/bundled-typescript\", \"package.json\"),\n  path.join(repoRoot, \"node_modules\", \"@typescript/bundled-typescript\", \"package.json\"),\n];\nif (!candidates.some(fs.existsSync)) {\n  throw new Error(\"Dependencies not installed — run npm install first\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["npm","dependencies","setup","build"],"backgroundTag":null,"analyzedSha":"1bcfa18d79a3be41772223d5c05dfe4480e614ff","analyzedAt":"2026-08-16T02:12:00.115Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}