multiformats / multiformats/js-multiformats
ERR_PACKAGE_PATH_NOT_EXPORTED
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 268
- Forks
- 57
- PR merge metrics
- No merged PRs in 30d
Description
Minimal sample with import:
import { CID } from 'multiformats';
async function main() {
console.log(CID.parse('QmaozNR7DZHQK1ZcU9p7QdrshMvXqWK6gpu5rmrkPdT3L4'));
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
Getting:
Error: No "exports" main defined in /home/dag-json-demo/node_modules/multiformats/package.json
at exportsNotFound (node:internal/modules/esm/resolve:304:10)
at packageExportsResolve (node:internal/modules/esm/resolve:594:13)
at resolveExports (node:internal/modules/cjs/loader:590:36)
at Function.Module._findPath (node:internal/modules/cjs/loader:667:31)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1129:27)
at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/home/dag-json-demo/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
at Function.Module._load (node:internal/modules/cjs/loader:984:27)
at Module.require (node:internal/modules/cjs/loader:1231:19)
at require (node:internal/modules/helpers:179:18)
at Object.<anonymous> (/home//dag-json-demo/scripts/demo/dag-json.ts:1:1) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}
Expected behavior:
Import CID
Environment:
@ipld/dag-json v10.2.2,
node v20.12.2
npm 10.5.0
tsx v4.16.2
tsconfig.json
{
"compilerOptions": {
"target": "es2020",
"module": "commonjs",
"strict": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"outDir": "dist",
"declaration": true,
"typeRoots": ["./typechain-types", "./node_modules/@types"],
"types": ["@nomiclabs/hardhat-ethers"]
},
"include": ["./scripts", "./test", "./typechain-types"],
"files": ["./hardhat.config.ts"]
}
The same result with tsconfig.json
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"strict": true,
"outDir": "dist",
"declaration": true,
"typeRoots": ["./typechain-types", "./node_modules/@types"],
"types": ["@nomiclabs/hardhat-ethers"]
},
"include": ["./scripts", "./test", "./typechain-types"],
"files": ["./hardhat.config.ts"]
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the import in scripts/demo/dag-json.ts and inspect multiformats/package.json, then reproduce the ERR_PACKAGE_PATH_NOT_EXPORTED error using Node 20, tsx, and the provided tsconfig.json variants. Done means the minimal sample can import CID and run without the reported package-resolution error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100