KevinAdhaikal / CAINode

A lightweight unofficial Character.AI API in Node/Deno/Bun JS.
https://www.npmjs.com/package/cainode
31 stars 7 forks source link

bug #4

Closed cifumo closed 1 month ago

cifumo commented 2 months ago

/home/jelastic/ROOT/node_modules/cainode/index.js:1 import WebSocket from "ws"; ^^^^^^

SyntaxError: Cannot use import statement outside a module at internalCompileFunction (node:internal/vm:76:18) at wrapSafe (node:internal/modules/cjs/loader:1283:20) at Module._compile (node:internal/modules/cjs/loader:1328:27) at Module._extensions..js (node:internal/modules/cjs/loader:1422:10) at Module.load (node:internal/modules/cjs/loader:1203:32) at Module._load (node:internal/modules/cjs/loader:1019:12) at ModuleWrap. (node:internal/modules/esm/translators:203:29) at ModuleJob.run (node:internal/modules/esm/module_job:195:25) at async ModuleLoader.import (node:internal/modules/esm/loader:337:24) at async Object.eval (eval at handler (file:///home/jelastic/ROOT/plugins/owner-exec.js?update=1727069046115:26:16), :3:12)

KevinAdhaikal commented 2 months ago

Have you tried like as example usage? and what Node JS Version you have? or are you using Bun JS or Deno?

cifumo commented 1 month ago

Have you tried like as example usage? and what Node JS Version you have? or are you using Bun JS or Deno?

im use nodejs v 18

KevinAdhaikal commented 1 month ago

Have you tried like the Example Usage?

KevinAdhaikal commented 1 month ago
(async function() {
    const client = new (await import("cainode")).CAINode();
    await client.login("Your token");
    console.log("Logged in!");
    await client.logout();
})()
KevinAdhaikal commented 1 month ago

is it solved?