Description
Running the enroll command from the self-host setup instructions (https://pdpp.dev/self-host) fails immediately with ERR_MODULE_NOT_FOUND.
Repro
npx -y @pdpp/local-collector enroll --base-url http://localhost:3000 --code <redacted> --device-label "My laptop"
Error
node:internal/modules/package_json_reader:314
throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null);
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@pdpp/reference-contract' imported from .../node_modules/@pdpp/local-collector/dist/polyfill-connectors/src/local-device-client.js
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:314:9)
at packageResolve (node:internal/modules/esm/resolve:768:81)
at moduleResolve (node:internal/modules/esm/resolve:855:18)
at defaultResolve (node:internal/modules/esm/resolve:985:11)
at #cachedDefaultResolve (node:internal/modules/esm/loader:747:20)
at ModuleLoader.resolve (node:internal/modules/esm/loader:724:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:320:38)
at ModuleJob._link (node:internal/modules/esm/module_job:182:49) {
code: 'ERR_MODULE_NOT_FOUND'
}
Node.js v22.22.3
Root cause
dist/polyfill-connectors/src/local-device-client.js in the published package imports:
import { canonicalTerminalRunCommitEnvelope } from "@pdpp/reference-contract/common";
but:
@pdpp/reference-contract is not listed in local-collector's package.json dependencies (only zod is listed), so npm/npx never installs it.
@pdpp/reference-contract does not exist on the public npm registry at all (npm view @pdpp/reference-contract returns a 404).
This looks like an internal pnpm-workspace package that's referenced in the compiled dist/ output but never got published or added as a real dependency when local-collector was packaged for npm.
I confirmed this import is present and unresolved in every published version I checked going back to 1.4.1 through the current 1.5.4, so this isn't a recent regression — the npm package appears to have never worked correctly for anyone outside the monorepo.
Environment
- Node.js v22.22.3
@pdpp/local-collector 1.5.4 (also reproduced on 1.5.3, 1.5.2, 1.5.0, 1.4.1)
- macOS
- Invoked via
npx -y @pdpp/local-collector ... per the self-host docs
Suggested fix
Either publish @pdpp/reference-contract to npm and add it as a real dependency of local-collector, or bundle/inline the needed exports into local-collector's build so the published package has no unresolved workspace-only imports.
Description
Running the enroll command from the self-host setup instructions (https://pdpp.dev/self-host) fails immediately with
ERR_MODULE_NOT_FOUND.Repro
Error
Root cause
dist/polyfill-connectors/src/local-device-client.jsin the published package imports:but:
@pdpp/reference-contractis not listed inlocal-collector'spackage.jsondependencies(onlyzodis listed), so npm/npx never installs it.@pdpp/reference-contractdoes not exist on the public npm registry at all (npm view @pdpp/reference-contractreturns a 404).This looks like an internal pnpm-workspace package that's referenced in the compiled
dist/output but never got published or added as a real dependency whenlocal-collectorwas packaged for npm.I confirmed this import is present and unresolved in every published version I checked going back to
1.4.1through the current1.5.4, so this isn't a recent regression — the npm package appears to have never worked correctly for anyone outside the monorepo.Environment
@pdpp/local-collector1.5.4 (also reproduced on 1.5.3, 1.5.2, 1.5.0, 1.4.1)npx -y @pdpp/local-collector ...per the self-host docsSuggested fix
Either publish
@pdpp/reference-contractto npm and add it as a real dependency oflocal-collector, or bundle/inline the needed exports intolocal-collector's build so the published package has no unresolved workspace-only imports.