   installPlugin: (name) ->
     @getMirrors().then =>
       new Promise (resolve) =>
-        npm.commands.install [name], =>
+        npm.commands.install [name], (err) =>
           plugin = @readPlugin_ path.join @pluginPath, 'node_modules', name
           @plugins_.push plugin
-          resolve plugin
+          if !err then resolve plugin else reject()
 
   # uninstall one plugin, this won't unload it from memory
   # @param {Plugin} plugin

path = require 'path-extra'
semver = require 'semver'
npm = require 'npm'

fs = Promise.promisifyAll require 'fs-extra'


        npm.load npmConfig, =>
          resolve @config_

  # get the current plugins
  # @return {Promise<Array<Plugin>>}
  getPlugins: ->
