PDF Loader Error: "Failed to load pdf-parse. This loader currently supports pdf-parse v1 only"

Hi everyone,

I’m running into an issue when trying to process PDF files in n8n.

Error Message
Failed to load pdf-parse. This loader currently supports pdf-parse v1 only.
Please install v1, e.g. npm install pdf-parse@^1
(v2 is not yet supported).
Environment
n8n Version: 2.20.9
Deployment: [Self-hosted / Docker / npm install]

What I’m Trying to Do

I’m using a PDF loader/document processing workflow and receiving the above error whenever n8n attempts to parse a PDF.

Questions
Has anyone encountered this issue recently?
Which component is requiring pdf-parse v1?
If running n8n in Docker, what is the recommended way to force installation of pdf-parse@^1?
Is there a compatibility fix or workaround until support for v2 is added?

Any guidance would be appreciated.

Thanks!

Hi @Bhavin_Patel

You are seeing this error because n8n is trying to read a PDF using a tool called pdf-parse. The problem is that the “Document Loader” node is designed to work only with an old version (v1) of this tool, but your system has a newer version (v2) installed. This version mismatch causes the process to crash.

This issue happens because n8n relies on an external library called LangChain to handle documents. LangChain has a strict rule in its code that checks for the specific version of the PDF parser. When it detects the newer version, it stops the workflow and tells you to downgrade, even though the newer version is generally more up-to-date.

The best and easiest solution is to update your n8n installation to version 2.23.0 or higher. The n8n team released a fix that replaces the picky LangChain loader with their own custom version. This new loader is compatible with pdf-parse v2, which eliminates the error and allows your PDFs to process normally.

If you cannot update n8n and you are using Docker, you can “force” the old version back into your system. You do this by creating a custom Dockerfile that specifically installs pdf-parse version 1.1.1. This effectively tricks the Document Loader into thinking the environment is correct so it can function again.

FROM docker.n8n.io/n8nio/n8n:2.20.9

USER root
RUN npm install -g pdf-parse@1.1.1
USER node

Note: You need build and run this image instead of the default one.

For a more reliable long-term workaround, you can skip the “Document Loader” node entirely. Instead, use a “Code Node” to extract the text from your PDF manually. By enabling a specific setting in your environment variables, you can tell n8n to let the Code Node handle the PDF directly, bypassing the buggy loader and getting your workflow moving.

Let me know if it is helpful