Replies: 1 comment
-
Hey @LaiYu111! I'm here to help you with your bug, answer your questions, and guide you on becoming a contributor. Let's take a look at the issue together. To resolve the errors related to Cheerio and PDFLoader, you need to import the modules correctly without using the For Cheerio, use the following import path: import { CheerioWebBaseLoader } from "@langchain/community/document_loaders/web/cheerio";
const loader = new CheerioWebBaseLoader("https://lilianweng.github.io/posts/2023-06-23-agent/");
const docs = await loader.load();
console.log({ docs }); For PDFLoader, use the following import path: import { PDFLoader } from "@langchain/community/document_loaders/fs/pdf";
const pdfLoader = new PDFLoader("./1.pdf");
const pdfDocs = await pdfLoader.load();
console.log({ pdfDocs }); Make sure you have installed all necessary dependencies: yarn add cheerio @langchain/community By following these steps, you should be able to resolve the errors related to Cheerio and PDFLoader in your Nest.js service [1][2]. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Checked other resources
Commit to Help
Example Code
Description
I am using nest.js and trying to write a service. I tried to load the PDF file and a web source, but an error occurred.
(Cheerio)
[ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './dist/document_loaders/web/cheerio' is not defined by "exports" in ..\node_modules@langchain\community\package.json
(PDFLoader)
r [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './dist/document_loaders/fs/pdf' is not defined by "exports" in \node_modules@langchain\community\package.json
System Info
node.js: 20.9.0
Platform: Windows
"langchain": "^0.2.11",
"pdf-parse": "^1.1.1",
"cheerio": "^1.0.0-rc.12",
Beta Was this translation helpful? Give feedback.
All reactions