From f640c72de63b935db956cc8e76b9a13854001bd7 Mon Sep 17 00:00:00 2001 From: Guillermo Rauch Date: Thu, 14 Jul 2016 09:25:49 -0700 Subject: [PATCH] plugins: more graceful npm error --- plugins.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/plugins.js b/plugins.js index 976d5d23..d0ee1ba9 100644 --- a/plugins.js +++ b/plugins.js @@ -58,10 +58,17 @@ function updatePlugins ({ force = false } = {}) { if (err) { console.error(err.stack); - notify( - 'Error updating plugins.', - 'Check `~/.hyperterm_plugins/npm-debug.log` for more information.' - ); + if (/not a recognized/.test(err.message) || /command not found/.test(err.message)) { + notify( + 'Error updating plugins.', + 'We could not find the `npm` command. Make sure it\'s in $PATH' + ); + } else { + notify( + 'Error updating plugins.', + 'Check `~/.hyperterm_plugins/npm-debug.log` for more information.' + ); + } } else { // flag successful plugin update cache.set('plugins', id_); @@ -186,7 +193,6 @@ function install (fn) { exec(prefix + 'npm prune && npm install --production', { cwd: path }, (err, stdout, stderr) => { - if (err) alert(err.stack); if (err) return fn(err); fn(null); });