PawanOsman / GoogleBard

GoogleBard - A reverse engineered API for Google Bard chatbot for NodeJS
https://bard.google.com
MIT License
415 stars 58 forks source link

ReactJS/NextJS Project: Module not found: Can't resolve 'fs' #11

Closed mashwishi closed 1 year ago

mashwishi commented 1 year ago

Issue:

wait  - compiling...
event - compiled client and server successfully in 914 ms (307 modules)
wait  - compiling / (client and server)...
error - ./node_modules/dbcontext/dist/classes/dbcontext.js:1:0
Module not found: Can't resolve 'fs'

Import trace for requested module:
./node_modules/dbcontext/dist/index.js
./node_modules/googlebard/dist/classes/app-dbcontext.js
./node_modules/googlebard/dist/classes/bard.js
./node_modules/googlebard/dist/index.js
./components/chat/messages.tsx
./pages/index.tsx

https://nextjs.org/docs/messages/module-not-found
Could not find files for / in .next/build-manifest.json
Could not find files for / in .next/build-manifest.json

Major Packages installed:


    "fs": "0.0.1-security",
    "googlebard": "^1.0.5",
    "next": "^12.0.9",
    "react": "17.0.2",
    "react-dom": "17.0.2",
mashwishi commented 1 year ago

How i implement the code:

import { Bard } from "googlebard";

//some other codes here...

const bot = new Bard(process.env.BARD_COOKIES, {
   inMemory: true, 
});

const conversationId = `${session.user.id }`

const bard_response = await bot.ask(newMessage, conversationId); 
console.log(bard_response);
mashwishi commented 1 year ago

Is there an alternative way to make things work, i believe fs will never work on reactjs and nextjs since it is a browser-based JavaScript environments

mashwishi commented 1 year ago

Well if this project is intended for server client only then ill just make a server side.

mashwishi commented 1 year ago

I am now moving this to backend as API and please check this latest issue: https://github.com/PawanOsman/GoogleBard/issues/12