Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERR_PACKAGE_PATH_NOT_EXPORTED #132

Closed
MentatX opened this issue Jul 25, 2024 · 1 comment
Closed

ERR_PACKAGE_PATH_NOT_EXPORTED #132

MentatX opened this issue Jul 25, 2024 · 1 comment

Comments

@MentatX
Copy link

MentatX commented Jul 25, 2024

Minimal sample with import:

import { encode } from '@ipld/dag-json';

async function main() {
    console.log(encode('QmaozNR7DZHQK1ZcU9p7QdrshMvXqWK6gpu5rmrkPdT3L4'));
}
  
main().catch((error) => {
    console.error(error);
    process.exitCode = 1;
});
  

Getting:

Error: No "exports" main defined in /home/dag-json-demo/node_modules/@ipld/dag-json/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/mentat/boosty/akave/internal/smart-contracts/hardhat-starter/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 encode

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"]
}
@rvagg
Copy link
Member

rvagg commented Jul 26, 2024

closing as duplicate of multiformats/js-multiformats#302

@rvagg rvagg closed this as completed Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants