realcoloride / node_characterai

Unofficial Character AI wrapper for node.
https://beta.character.ai/
346 stars 72 forks source link

Warning: the specified Chromium path for puppeteer could not be located. #86

Closed NanduWasTaken closed 1 year ago

NanduWasTaken commented 1 year ago

I seem to be encountering this a error.

CODE

const CharacterAI = require("node_characterai");
const characterAI = new CharacterAI();

(async () => {
  // Authenticating as a guest (use `.authenticateWithToken()` to use an account)
  await characterAI.authenticateAsGuest();

  // Place your character's id here
  const characterId = "8_1NyR8w1dOXmI1uWaieQcd147hecbdIK7CeEAIrdJw";

  const chat = await characterAI.createOrContinueChat(characterId);

  // Send a message
  const response = await chat.sendAndAwaitResponse("Hello discord mod!", true);

  console.log(response);
  // Use `response.text` to use it as a string
})();

Error

ErrorMessage

System Info

Node Version: 18.16.1 OS: Ubuntu

Parking-Master commented 1 year ago

I implemented this warning - logically this way:

Is the user operating on Linux? If they aren't > Do nothing; If they are > Try to locate the chromium path (/usr/bin/chromium-browser) If that path exists > Use it when starting puppeteer; If that path doesn't exist > Warn the user on startup;

So, of course, you are operating on Linux (Ubuntu). Most Linux systems store the chromium binary file in /usr/bin/chromium-browser.

However, it seems to not exist on your system - Hence the warning.

So, to fix this - You just need to search for the chromium binary file on your system. This is not recommended to do manually though, you may want to search up "Where is the chromium binary file on Linux?".

Once this is done, head over to the requester.js file in the node_characterai package (./node_modules/node_characterai/requester.js) and find the "puppeteerPath" variable.

Paste the path into that variable and restart your script.

Parking-Master commented 1 year ago

Ok, so it seems there's a simple way. First, just check if you have chromium installed. Type this in your terminal:

$ which chromium-browser

If it gives you a path, continue doing the above steps (put it as the default launch path).

If it gives you an error, chromium is not installed. Search how to install chromium on linux. Most of the time you can just do this:

$ sudo apt install chromium-browser

Safety tip: Always make sure your system is up to date!

realcoloride commented 1 year ago

Hey there!

I don't have Linux, but you should try @parking-master 's commands. It seems however that Chromium is not installed on your machine. Make sure to specify the path of your chromium folder/executable if needed.

Good luck and keep us updated!

Parking-Master commented 1 year ago

@NanduWasTaken did this solve your problem? Please let us know so we can close this issue!

NanduWasTaken commented 1 year ago

@NanduWasTaken did this solve your problem? Please let us know so we can close this issue!

Yeah.

NanduWasTaken commented 1 year ago

Thanks for your Help.