Can this "module not found" error also occur in Node.js environments, or is it strictly a front-end bundling problem?

Question

Grade: Education Subject: Support
Can this "module not found" error also occur in Node.js environments, or is it strictly a front-end bundling problem?
Asked by:
117 Viewed 117 Answers

Answer (117)

Best Answer
(739)
While the "module not found error can't resolve crypto in bcryptjs" is overwhelmingly a front-end bundling problem (Webpack, Vite, CRA) where Node.js built-ins are unavailable, it is theoretically possible, though extremely rare, for it to occur in a Node.js environment under very specific circumstances. For example, if a custom Node.js runtime or a highly stripped-down environment somehow prevented access to or removed the `crypto` module, this error could surface. However, for standard Node.js installations, the `crypto` module is a core built-in and is always available, so this error practically serves as a strong indicator that `bcryptjs` is being incorrectly bundled for or executed in a non-Node.js, browser-like environment.