FAQ

Frequently Asked Questions

Here's a list of commonly asked questions. If you have something that you feel like should be added here, submit an issue here (opens in a new tab).

Can't use Bard

The first thing to ensure is that (if you are only providing the Cookie value), that you are using the correct cookie.

If that's all correct, go to bard.google.com, reset all your Cookies (not just your cache), and log in again to your Google account. Finally, get your new PSID.

If you still cannot use Bard, try appending adding the PSIDTS cookie, as shown here.

If that still doesn't work, then submit an issue here (opens in a new tab).

SyntaxError: Cannot use import statement outside a module

See here (opens in a new tab) for information on enabluing ES6 in NodeJS. In other words, either you should set the type field in your package.json to "module" (e.g. {"type": "module"}) or rename the scripts that use ES6 imports from their .js extension to .mjs extension

Can't require a ES6 module

bard-ai is now a strictly ES6 only module. This means that it only works with the import syntax. You can choose to migrate to ESM yourself (recommended), or alternatively use dynamic import (opens in a new tab) if you still want to remain in CommonJS.

For example:

import("bard-ai").then(async ({ default: Bard }) => {
  const myBard = new Bard(COOKIE);
  console.log(await myBard.ask("Hello, world!"));
});

fetch is undefined

The fetch function is still experimental (though enabled by default) in Node. Learn about polyfilling fetch, easier than ever in v2, here.