MongoDB Node.js driver missing dependencies when installed with PNPM

Hello.

Whenever I try to deploy my application, which uses Node.js for the backend and MongoDB for the database, I get errors at runtime related to missing dependencies (BSON or mongodb-connection-string-url, for example).

I use PNPM, and unless I add the --shamefully-hoist flag, I get said errors.

I haven’t had this issue with any other packages. I even tried in a new project, and the same behaviour was observed, with the only dependency in said project being MongoDB.

Hi @Abdelfattah_Radwan, and thank you for reporting this issue. I’ve opened NODE-5941 to have our team investigate further, however I’m not familiar with PNPM. Would you be able to share reproduction steps so that we can validate the issue?

1 Like

Thank you! I will be sharing reproduction steps alongside a small reproduction project you can use to further investigate.

After further investigation, it turns out that the issue was due to a corrupt PNPM installation on my production server.

Thanks for sharing. I’ll close the associated ticket but if there are other challenges with PNPM we can investigate further at that time.

1 Like