Skip to content

Error [ERR_REQUIRE_ESM]: require() of ES Module #10

Description

@arthurzenika

Trying to run meshcore-decoder on a raspberry pi model B (armv6) on debian bookworm I get :

# meshcore-decoder -h
/usr/local/lib/node_modules/@michaelhart/meshcore-decoder/dist/crypto/ed25519-verifier.js:39
const ed25519 = __importStar(require("@noble/ed25519"));
                             ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /usr/local/lib/node_modules/@michaelhart/meshcore-decoder/node_modules/@noble/ed25519/index.js from /usr/local/lib/node_modules/@michaelhart/meshcore-decoder/dist/crypto/ed25519-verifier.js not supported.
Instead change the require of index.js in /usr/local/lib/node_modules/@michaelhart/meshcore-decoder/dist/crypto/ed25519-verifier.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/usr/local/lib/node_modules/@michaelhart/meshcore-decoder/dist/crypto/ed25519-verifier.js:39:30)
    at Object.<anonymous> (/usr/local/lib/node_modules/@michaelhart/meshcore-decoder/dist/decoder/payload-decoders/advert.js:9:28)
    at Object.<anonymous> (/usr/local/lib/node_modules/@michaelhart/meshcore-decoder/dist/decoder/packet-decoder.js:10:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/@michaelhart/meshcore-decoder/dist/cli.js:40:26) {
  code: 'ERR_REQUIRE_ESM'
}

Node.js v18.20.4
# npm --version
9.2.0

Tried to do a npm install -g @noble/ed25519 but that didn't solve it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions