Closed KtechB closed 1 year ago
So there are two problems.
1) It's not exporting ES modules yet. There are open PRs for enabling that, though.
2) You are trying to use it on the client side (inside the browser). That won't work currently as these functions use nodejs native modules, like stream
and fs
etc. You would need to use an SSR function and import it there. Or a real nodejs backend server.
@DennisKo Thank you for answering.
That won't work currently as these functions use nodejs native modules, like stream and fs etc.
I got it. I didn't know Langchain.js is for node.js, not for client-side. Are there any plans to support frontend in the future? If so, it might be better close this issue.
Hi @KtechB at the moment the library is designed for node only. We're planning on supporting additional environments in the future, collecting some thoughts from the community on what environment we should support next at #152
Support for Browsers, Cloudflare workers, Nextjs/vercel (browser/serverless/edge), Deno, Supabase edge functions has been released, see https://blog.langchain.dev/js-envs/ for details. See the docs for install/upgrade instructions https://js.langchain.com/docs/getting-started/install including some breaking changes
Any issues let me know
First of all, I'm glad to use langchain in Javascript. Thank you to the creators.
However when I tried to use langchain.js in React-vite project, the code seems to fail.
This code is React-vite initial code with langchain's LLM import.
Run this app
yarn dev
then, I got this error in console.Not only OpenAI, other classes also give me import error.
Running node v16.13.0 on macOs Montery 12.3.1 , apple silicon m1 chip.
Anyone know how to resolve this probrem?