MongoMissingDependencyError: mongodb-client-encryption on macOS ARM64 (Apple Silicon)
The Issue
I am encountering a MongoMissingDependencyError when running my Meteor application in development mode on macOS (Apple Silicon/ARM64), despite successfully installing and rebuilding the dependency.
The application crashes on server startup when initializing a service that uses client-side encryption (ClientEncryption).
Error Details
MongoMissingDependencyError: Optional module `mongodb-client-encryption` not found. Please install it to use auto encryption or ClientEncryption.
...
I20251028-14:47:47.330(1)? [cause]: Error: Cannot find module 'mongodb-client-encryption'
I20251028-14:47:47.331(1)? Require stack:
I20251028-14:47:47.331(1)? - .../.meteor/packages/npm-mongo/.6.16.1.../npm/node_modules/mongodb/lib/deps.js
Steps Taken (and Failed)
I have performed extensive cleanup and rebuilding, which did not resolve the issue.
- Platform: macOS ARM64 (Apple Silicon)
- MongoDB Driver in Meteor:
npm-mongo@.6.16.1(which bundlesmongodb@~6.1.x)
| Action | Result | Note |
|---|---|---|
meteor npm install --save mongodb-client-encryption |
Installed successfully. | Placed module in project node_modules. |
meteor npm rebuild mongodb-client-encryption |
Completed successfully. | Confirms native binary (.node file) was compiled for os.osx.arm64. |
Cleared caches (rm -rf node_modules .meteor/local/build) |
Performed full cleanup and re-run. | Error persists upon server boot. |
The Core Problem
The requireStack shows that the internal npm-mongo package is trying to resolve the dependency from its cached location (.meteor/packages/npm-mongo/...) and is not finding the module that was successfully rebuilt in the top-level project node_modules folder.
How can I force Meteor’s bundled MongoDB driver to correctly resolve the path to the installed and rebuilt mongodb-client-encryption module on ARM64?