RyuuGan / sol-merger

Merges all imports into single file for solidity contracts
BSD 2-Clause "Simplified" License
157 stars 22 forks source link

Quick Installation doesn't work #71

Closed carl-egge closed 1 year ago

carl-egge commented 1 year ago

I installed the sol-merger using npm following the readme. The I copied the short code segment from the Quick Usage and executed an according script. This is my error:

const mergedCode = await merge('./demo/src/Oracles.sol');
                   ^^^^^

SyntaxError: await is only valid in async functions and the top level bodies of modules
    at internalCompileFunction (node:internal/vm:73:18)
    at wrapSafe (node:internal/modules/cjs/loader:1175:20)
    at Module._compile (node:internal/modules/cjs/loader:1219:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1309:10)
    at Module.load (node:internal/modules/cjs/loader:1113:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
    at node:internal/main/run_main_module:23:47

Node.js v20.3.0
RyuuGan commented 1 year ago

Hello,

await is only valid in async functions and the top level bodies of modules

So you need to use it inside the async function or on the top level bodies of modules, otherwise it is not allowed yet.

But looks like you are using neither of them.

Best regards, Valerii Aligorskii.

carl-egge commented 1 year ago

Hi, thank you for the quick response. Since I used the code snippet from the readme your should maybe update that such that it works. Best regards, Carl