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

Cannot find module 'crystals-kyber-ts\dist\services\kyber512.service' imported from crystals-kyber-ts\dist\index.js #5

Open
jordanbtucker opened this issue Mar 26, 2023 · 0 comments

Comments

@jordanbtucker
Copy link

jordanbtucker commented Mar 26, 2023

Running the following file with Node.js, I get the following error:

import {Kyber1024Handshake} from 'crystals-kyber-ts'
node:internal/errors:490
    ErrorCaptureStackTrace(err);
    ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'D:\Users\Jordan\Desktop\kyber-test\node_modules\crystals-kyber-ts\dist\services\kyber512.service' imported from D:\Users\Jordan\Desktop\kyber-test\node_modules\crystals-kyber-ts\dist\index.js
    at new NodeError (node:internal/errors:399:5)
    at finalizeResolution (node:internal/modules/esm/resolve:326:11)
    at moduleResolve (node:internal/modules/esm/resolve:945:10)
    at defaultResolve (node:internal/modules/esm/resolve:1153:11)
    at nextResolve (node:internal/modules/esm/loader:163:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:838:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40)
    at link (node:internal/modules/esm/module_job:76:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Node.js v18.15.0

Since package.json has type: "module", all import specifiers need to have file extensions.

Recommended reading: https://www.typescriptlang.org/docs/handbook/esm-node.html

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

1 participant