Skip to content

Commit 90a9d35

Browse files
committed
fix: check MongoBinary module presense in postinstall script
1 parent e23c62e commit 90a9d35

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

postinstall.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ It helps to skip timeout setup `jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000;`
88
when first test run hits MongoDB binary downloading to the cache.
99
*/
1010

11-
if (require.resolve('./lib/util/MongoBinary')) {
11+
function isModuleExists(name) {
12+
try { return !!require.resolve(name); }
13+
catch(e) { return false }
14+
}
15+
16+
if (isModuleExists('./lib/util/MongoBinary')) {
1217
const MongoBinary = require('./lib/util/MongoBinary').default;
1318

1419
console.log('mongodb-memory-server: checking MongoDB binaries cache...');

0 commit comments

Comments
 (0)