Skip to content

Commit ad99c5c

Browse files
anandgupta42claude
andcommitted
fix: add npm whoami auth verification before publish
Debug persistent npm 404 errors during `v0.5.11` publish — verifies auth is configured correctly before attempting any package publishes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d9d4ea0 commit ad99c5c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

packages/opencode/script/publish.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,18 @@ await Bun.file(`./dist/${pkg.name}/package.json`).write(
107107
),
108108
)
109109

110+
// Verify npm auth before publishing
111+
console.log("Verifying npm authentication...")
112+
const npmrcPath = process.env.NPM_CONFIG_USERCONFIG || "~/.npmrc"
113+
console.log(`NPM_CONFIG_USERCONFIG=${npmrcPath}`)
114+
try {
115+
const whoami = await $`npm whoami`.text()
116+
console.log(`npm whoami: ${whoami.trim()}`)
117+
} catch (e: any) {
118+
console.error("npm whoami failed — auth may be misconfigured:", e?.stderr || e)
119+
process.exit(1)
120+
}
121+
110122
const tasks = Object.entries(binaries).map(async ([name]) => {
111123
if (process.platform !== "win32") {
112124
await $`chmod -R 755 .`.cwd(`./dist/${name}`)

0 commit comments

Comments
 (0)