{"record":{"id":"15739416ecea9ab5","repo":"Hmbown/CodeWhale","slug":"npm-pack-did-not-return-package-metadata","errorCode":null,"errorMessage":"npm pack did not return package metadata","messagePattern":"npm pack did not return package metadata","errorType":"console","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/release/npm-wrapper-smoke.js","lineNumber":127,"sourceCode":"    }\n  });\n\n  return new Promise((resolve, reject) => {\n    server.once(\"error\", reject);\n    server.listen(0, \"127.0.0.1\", () => {\n      const address = server.address();\n      resolve({\n        baseUrl: `http://127.0.0.1:${address.port}/`,\n        server,\n      });\n    });\n  });\n}\n\nfunction parsePackJson(stdout) {\n  const trimmed = stdout.trim();\n  if (!trimmed) {\n    throw new Error(\"npm pack did not return package metadata\");\n  }\n  const parsed = JSON.parse(trimmed);\n  const first = Array.isArray(parsed) ? parsed[0] : parsed;\n  if (!first || !first.filename) {\n    throw new Error(`npm pack metadata did not include a filename: ${trimmed}`);\n  }\n  return first.filename;\n}\n\nasync function removeSmokeWorkspace(tempRoot, remove = fsp.rm) {\n  await remove(tempRoot, {\n    force: true,\n    recursive: true,\n    // Windows can report ENOTEMPTY briefly while completed binary downloads\n    // are still being released by the filesystem. fs.rm retries ENOTEMPTY\n    // (and the other documented transient removal errors) with linear\n    // backoff; the finite cap still surfaces a persistent cleanup failure.\n    maxRetries: CLEANUP_MAX_RETRIES,","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/scripts/release/npm-wrapper-smoke.js#L109-L145","documentation":"Thrown by parsePackJson() when `npm pack --json` produced empty or whitespace-only stdout, so there is no package metadata to parse. Causes include npm failing silently, wrong working directory (no package to pack), or npm emitting output on stderr instead of stdout; the smoke test cannot identify the produced tarball without it.","triggerScenarios":"Thrown at scripts/release/npm-wrapper-smoke.js:127 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run `npm pack --json` manually in the intended directory to see what it prints","Ensure the script runs in the package directory and that npm is on PATH and functional","Check npm's stderr for the real failure; an npm error may have produced empty stdout"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"433685b2024e7bc4c99e1e2e326bcad39b4d9d65","analyzedAt":"2026-09-15T12:24:24.634Z","contentChangedAt":"2026-09-15T12:24:24.634Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}