shanewholloway/js-u8-mqtt

Error while trying to import mqtt_client

Closed this issue · 4 comments

Hi,
I am trying to follow the example from the Readme file for Node.js but when i try to import the mqtt_client I get following error

import mqtt_client from 'u8-mqtt/esm/node/index.mjs'
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at Object.compileFunction (node:vm:352:18)
    at wrapSafe (node:internal/modules/cjs/loader:1033:15)
    at Module._compile (node:internal/modules/cjs/loader:1069:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Module._load (node:internal/modules/cjs/loader:827:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47

Email reply broke my links — fixed in GitHub issue thread

Did this resolve your question?

Hey @shanewholloway sorry.. I forgot to reply you back.. Yep... it did solve the problem. Thanks for help and keeping the library alive.