LayerZero-Labs / LayerZero-v1

An Omnichain Interoperability Protocol
Other
1.96k stars 1.25k forks source link

SyntaxError: Missing initializer in destructuring declaration #49

Open alkindivv opened 9 months ago

alkindivv commented 9 months ago

i already declare LayerZero-SDK with this "const { LayerZero } require('@layerzerolabs/lz-sdk');" but when i tried to run the code, i got this problem


EVM & Sol » node main-2.js                                                                                      ~/Desktop/EVM & Sol 1 ↵ 
file:///Users/alkindivv/Desktop/EVM%20&%20Sol/main-2.js:3
const { LayerZero } require('@layerzerolabs/lz-sdk');
      ^^^^^^^^^^^^^

SyntaxError: Missing initializer in destructuring declaration
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:155:18)
    at callTranslator (node:internal/modules/esm/loader:285:14)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:291:30)
    at async link (node:internal/modules/esm/module_job:76:21)

Node.js v20.10.0
oaknetinc commented 9 months ago

Well done

tamved commented 9 months ago

As for the issue you encountered with the LayerZero-SDK, it seems like there's a syntax error in the code. The correct syntax for importing the LayerZero module should be "const { LayerZero } = require('@layerzerolabs/lz-sdk');". Make sure to use the "=" sign after "LayerZero" in the destructuring declaration.

const { LayerZero } = require('@layerzerolabs/lz-sdk');

alkindivv commented 9 months ago

My bad, thankyou!