Are some NPM packages incompatible?

Describe the problem

I have an n8n instance running in docker. I added a few npm packages to try out if they work normally.

Here is my command for adding the packages in the docker:

RUN npm install -g mongodb mysql apexcharts markdown-it markdown-parser pdf-parser pdfjs redis exceljs

All the npm packages can be found inside the image that gets created, but when I go into n8n, a few of them don’t work as I expect them. For example if I call the mongodb package it works fine.

But if I call exceljs it returns an error.

It is clear that the npm package gets recognized, because you can see it in the stack trace. Another type of error I get is with pdf-parser.

When I tried these same packages in a normal js file outside of n8n, they ran fine.

So my question would be if there is something that defines what npm packages can be added to n8n? Is there a workaround to adding these packages?

Please share your workflow

Information on your n8n setup

  • n8n version: 1.115.3
  • Database (default: SQLite): Postgres
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Windows 11