You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm probably doing something fundamentally wrong but the example code appears to throw await promise errors as documented below. All advice welcomed.
Steps to reproduce:
Install npm package: npm i node-emberplus
Create file from example code:
const {EmberClient, EmberClientEvent, LoggingService} = require('node-emberplus');
const client = new EmberClient({host: '192.168.1.2', port: 9000, logger: new LoggingService(5)});
client.on(EmberClientEvent.ERROR, e => {
console.log(e);
});
await client.connectAsync();
// Get Root info
await client.getDirectoryAsync();
// Get a Specific Node
let node: TreeNode = await client.getElementByPathAsync("0.0.2");
console.log(node);
// Get a node by its path identifiers
node = await client.getElementByPathAsync("path/to/node");
console.log(node);
// Expand entire tree
try {
await client.expandAsync();
}catch(e) {
console.log(e.stack);
};
Run:
[user-hidden]% node index.js
[full-path-hidden]/lawo-node-ember-plus/index.js:7
await client.connectAsync();
^^^^^
SyntaxError: await is only valid in async functions and the top level bodies of modules
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1027:15)
at Module._compile (node:internal/modules/cjs/loader:1063:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47
Node.js v17.8.0
The text was updated successfully, but these errors were encountered:
I'm probably doing something fundamentally wrong but the example code appears to throw await promise errors as documented below. All advice welcomed.
Steps to reproduce:
Install npm package:
npm i node-emberplus
Create file from example code:
Run:
The text was updated successfully, but these errors were encountered: