diff --git a/app/plugins.js b/app/plugins.js index d6bafd0f..01678c4e 100644 --- a/app/plugins.js +++ b/app/plugins.js @@ -57,8 +57,7 @@ function updatePlugins({force = false} = {}) { if (err) { //eslint-disable-next-line no-console - console.error(err.stack); - notify('Error updating plugins.', err.message); + notify('Error updating plugins.', err); } else { // flag successful plugin update cache.set('hyper.plugins', id_); @@ -135,7 +134,7 @@ if (cache.get('hyper.plugins') !== id || process.env.HYPER_FORCE_UPDATE) { console.log('plugins have changed / not init, scheduling plugins installation'); setTimeout(() => { updatePlugins(); - }, 5000); + }, 1000); } // otherwise update plugins every 5 hours @@ -243,9 +242,14 @@ function requirePlugins() { return mod; } catch (err) { - //eslint-disable-next-line no-console - console.error(err); - notify('Plugin error!', `Plugin "${basename(path_)}" failed to load (${err.message})`); + if (err.code === 'MODULE_NOT_FOUND') { + //eslint-disable-next-line no-console + console.warn(`Plugin "${basename(path_)}" not found: ${path_}`); + } else { + //eslint-disable-next-line no-console + console.error(err); + notify('Plugin error!', `Plugin "${basename(path_)}" failed to load (${err.message})`); + } } }; diff --git a/app/plugins/install.js b/app/plugins/install.js index acd76e3c..145365b9 100644 --- a/app/plugins/install.js +++ b/app/plugins/install.js @@ -25,9 +25,9 @@ module.exports = { timeout: ms('5m'), maxBuffer: 1024 * 1024 }, - err => { + (err, stdout, stderr) => { if (err) { - cb(err); + cb(stderr); } else { cb(null); } diff --git a/lib/utils/plugins.js b/lib/utils/plugins.js index e4796ebb..0299574b 100644 --- a/lib/utils/plugins.js +++ b/lib/utils/plugins.js @@ -123,8 +123,10 @@ const loadModules = () => { reduceTermGroups: termGroupsReducers }; + const loadedPlugins = plugins.getLoadedPluginVersions().map(plugin => plugin.name); modules = paths.plugins .concat(paths.localPlugins) + .filter(plugin => loadedPlugins.indexOf(plugin) !== -1) .map(path => { let mod; const pluginName = getPluginName(path);