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

Import Failing - [ERR_MODULE_NOT_FOUND] #24

Open
skyrover7 opened this issue Oct 13, 2024 · 5 comments
Open

Import Failing - [ERR_MODULE_NOT_FOUND] #24

skyrover7 opened this issue Oct 13, 2024 · 5 comments

Comments

@skyrover7
Copy link

skyrover7 commented Oct 13, 2024

This is probably a silly issue, but can't seem to find the solution. I have a super basic node project setup and for whatever reason am not able to properly import ecpair.

Basic code sample

import { ECPairFactory } from 'ecpair';
import * as ecc from 'tiny-secp256k1';

const ECPair = ECPairFactory(ecc);
console.log(ECPair);

Error

node:internal/errors:490
    ErrorCaptureStackTrace(err);
    ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'E:\folder\project\node_modules\ecpair\src\esm\ecpair' imported from E:\folder\project\node_modules\ecpair\src\esm\index.js
    at new NodeError (node:internal/errors:399:5)
    at finalizeResolution (node:internal/modules/esm/resolve:232:11)
    at moduleResolve (node:internal/modules/esm/resolve:850:10)
    at defaultResolve (node:internal/modules/esm/resolve:1070:11)
    at DefaultModuleLoader.resolve (node:internal/modules/esm/loader:306:12)
    at DefaultModuleLoader.getModuleJob (node:internal/modules/esm/loader:155:32)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:33)
    at link (node:internal/modules/esm/module_job:75:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Environment

  • Windows
  • Node v20
  • Using "type": "module" in package.json
  • Using "bitcoinjs-lib": "^7.0.0-rc.0"
  • Using "ecpair": "^3.0.0-rc.0",
@mint-pz
Copy link

mint-pz commented Nov 2, 2024

I got the same issue with ecpair v3, but v2 still works for me

@junderw
Copy link
Member

junderw commented Nov 2, 2024

Can you try #26 out? I think this addresses the issue.

@skyrover7
Copy link
Author

I got the same issue with ecpair v3, but v2 still works for me

yea took me a while to realize this! lol

@skyrover7
Copy link
Author

Can you try #26 out? I think this addresses the issue.

will give it a go

@decentraliser
Copy link

Same for me

environment:

"bitcoinjs-lib": "^7.0.0-rc.0"
"ecpair": "^3.0.0-rc.0"
node v18.20.4
package.json type = module

downgrading ecpair to 2.1.0 did the job

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

4 participants