Closed barrynorman closed 1 year ago
This isn't a bug of Bard, just a general JavaScript error. Try changing your start
script to ts-node --esm ./src/index.ts
Yep! bard-ai
only works with modern "ESM" import
syntax, as per standards these days.
Still not working. --esm
does not help.
Did one of you tried my example?
try this
async getBardRes(text) {
const importDynamic = new Function(
'modulePath',
'return import(modulePath)',
);
const { init, askAI } = await importDynamic('bard-ai');
await init(COOKIE_KEY);
return await askAI(text);
}
@gelevanog well, i tried this but it throws Error like this. I comment await init(COOKIE_KEY);
, it throws error at askAI similar to init.
I used NestJS and my os is ubuntu.
Hello!
I'm trying to implement a short typescript script to play around, but somehow I am not able to get it running. Here are the most important files.
When I try
npm run start
i get this:
Any idea why? I'm not sure if i understand the error.