Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDFLoader is not working - Cannot find package 'pdf-parse' #445

Closed
kulaone opened this issue Mar 23, 2023 · 5 comments
Closed

PDFLoader is not working - Cannot find package 'pdf-parse' #445

kulaone opened this issue Mar 23, 2023 · 5 comments

Comments

@kulaone
Copy link

kulaone commented Mar 23, 2023

When loading the library the PDFLoader won't work unless runing a npm install inside the library.
This is because the package: "pdf-parse": "^1.1.1", is not found.

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'pdf-parse' imported from /home/runner/LangChain/node_modules/langchain/dist/document_loaders/pdf.js

Can we add it to the "dependencies" area in package.json?

@nfcampos
Copy link
Collaborator

Hi, you can fix this by installing pdf-parse, by running npm i pdf-parse or yarn add pdf-parse in your project. pdf-parse is set as a peer dependency because not everyone using langchain needs it.

@kulaone
Copy link
Author

kulaone commented Mar 24, 2023

Hi @nfcampos,
Hi, thanks for your response. I understand that pdf-parse is set as a peer dependency, it would be helpful to have that information documented somewhere. As someone who may not be familiar with all the dependencies required for LangChain, it would be helpful to know what I need to install in order for each part of the library to work properly.

@nfcampos
Copy link
Collaborator

We're actively working on improving the docs, will make sure to include this, thanks for letting us know

@Lionardo
Copy link

I agree with @kulaone this needs to be documented. Just run into this issue myself.

@nfcampos
Copy link
Collaborator

Hi, we have now added this to the docs, see https://js.langchain.com/docs/modules/indexes/document_loaders/examples/file_loaders/pdf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants