Skip to content

Fails to run on Node v22, SyntaxError; Unexpected identifier 'assert' #454

@sealer3

Description

@sealer3

Describe the bug

A SyntaxError appears when trying to run dappnodesdk on Node v22:

file:///home/dappno/.nvm/versions/v22.14.10/lib/node_modules/@dappnode/dappnodesdk/dist/tasks/generatePublishTxs/index.js:8
import registryAbi from "../../contracts/ApmRegistryAbi.json" assert { type: "json" };
                                                              ^^^^^^

SyntaxError; Unexpected identifier 'assert'
    at compileSourceTextModule (node:internal/modules/esm/utils:338:16)
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:102:18)
    at #translate (node:internal/modules/esm/loader:468:12)
    at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:515:27)

This is due to an "import assertion", a feature of Node v16 and v17 which was marked as experimental then and replaced with "import attributes" in v18. The functionality has been deprecated for a long time and was removed in Node v22.

To Reproduce

nvm use 22
npx @dappnode/dappnodesdk -h

Expected behavior

The help menu is shown.

Screenshots

DAppNode version: (SDK version) 0.3.35

(Does not depend on these, didn't even get to starting dappnode)

  • Package version:
  • OS:
  • Browser

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions