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

no such file or directory node_modules/tiny-secp256k1/lib/secp256k1.wasm #116

Closed
learntheropes opened this issue Jun 6, 2023 · 8 comments

Comments

@learntheropes
Copy link

learntheropes commented Jun 6, 2023

I'm using tiny-secp256k1 and bitcoinjs-lib with Nuxt 3 (Nitro server engine): https://nuxt.com/docs/guide/concepts/server-engine

"scripts": {
    "build": "nuxi build",
    "start": "node .output/server/index.mjs",
    "dev": "nuxi dev",
},
"dependencies": {
    "bip32": "^4.0.0",
    "bip39": "^3.1.0",
    "bitcoinjs-lib": "^6.1.0",
    "bitcoinjs-message": "^2.2.0",
    "tiny-secp256k1": "^2.2.2",
}
import { networks } from 'bitcoinjs-lib';
import BIP32Factory from 'bip32';
import * as ecc from 'tiny-secp256k1';
const bip32 = BIP32Factory.default(ecc);

With npm run dev works correctly, but with npm run build && npm run start I get:

ENOENT: no such file or directory, open '/home/giovanni/Documents/Dev/btcpay-booking/.output/server/node_modules/tiny-secp256k1/lib/secp256k1.wasm'

What could be the issue?

As of now, I resolved using https://github.com/bitcoinerlab/secp256k1

Is this the way to go?

@junderw
Copy link
Member

junderw commented Jun 6, 2023

This sounds like a Nuxt issue.

I just npm installed the latest version and the file is there:

$ ls node_modules/tiny-secp256k1/lib/
cjs                rand.js              wasm_loader.browser.d.ts
index.d.ts         secp256k1.wasm       wasm_loader.browser.js
index.js           validate.d.ts        wasm_loader.d.ts
rand.browser.d.ts  validate_error.d.ts  wasm_loader.js
rand.browser.js    validate_error.js    wasm_path.d.ts
rand.d.ts          validate.js          wasm_path.js

@junderw junderw closed this as completed Jun 6, 2023
@junderw
Copy link
Member

junderw commented Jun 6, 2023

Is this the way to go?

I have looked over bitcoinerlab's library and it seems fine. If that works, it should be fine.

@Demiduska
Copy link

Hello, did you solve the problem?

@learntheropes
Copy link
Author

@Demiduska I'm using https://github.com/bitcoinerlab/secp256k1 package

@Demiduska
Copy link

Unfortunately, I have internal libraries, which use tiny-secp256k1.
Did you use Vercel to deploy the app or other hosting?

@learntheropes
Copy link
Author

Digital Ocean.
On Vercel I always face the problem of slow app when I have big server functions due to cold start, I think.

@Demiduska
Copy link

https://github.com/bitcoinerlab/secp256k1 package

Thank you, I rewrote the code for https://github.com/bitcoinerlab/secp256k1 package and it starts working.

@Sentini14
Copy link

Which one is the best

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