From ab7ee0eb4f3f93b31220613fe08176450e2b68de Mon Sep 17 00:00:00 2001 From: Yuri <65935022+tuyuribr3@users.noreply.github.com> Date: Wed, 10 Aug 2022 13:46:43 -0300 Subject: [PATCH] Fixing remote auth optional depencies error (#1640) Co-authored-by: Rajeh Taher --- src/authStrategies/RemoteAuth.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/authStrategies/RemoteAuth.js b/src/authStrategies/RemoteAuth.js index 1645ccd..5ae85cc 100644 --- a/src/authStrategies/RemoteAuth.js +++ b/src/authStrategies/RemoteAuth.js @@ -6,7 +6,9 @@ try { var unzipper = require('unzipper'); var archiver = require('archiver'); } catch { - throw new Error('Optional Dependencies [fs-extra, unzipper, archiver] are required to use RemoteAuth. Make sure to run npm install correctly and remove the --no-optional flag'); + fs = undefined; + unzipper = undefined; + archiver = undefined; } const path = require('path'); @@ -23,6 +25,7 @@ const BaseAuthStrategy = require('./BaseAuthStrategy'); */ class RemoteAuth extends BaseAuthStrategy { constructor({ clientId, dataPath, store, backupSyncIntervalMs } = {}) { + if (!fs && !unzipper && !archiver) throw new Error('Optional Dependencies [fs-extra, unzipper, archiver] are required to use RemoteAuth. Make sure to run npm install correctly and remove the --no-optional flag'); super(); const idRegex = /^[-_\w]+$/i; @@ -198,4 +201,4 @@ class RemoteAuth extends BaseAuthStrategy { } } -module.exports = RemoteAuth; \ No newline at end of file +module.exports = RemoteAuth;