diff --git a/bin/pnpm-install b/bin/pnpm-install index cf64ed61b0..89ed08e1e4 100755 --- a/bin/pnpm-install +++ b/bin/pnpm-install @@ -130,6 +130,9 @@ function logger () { } else if (status === 'dependencies') { t.status(chalk.gray('' + pkgData.version + ' ·')) .details('') + } else if (status === 'error') { + t.status(chalk.red('ERROR ✗')) + .details(args && (args.message || args)) } else { t.status(status) .details('') diff --git a/lib/err.js b/lib/err.js index 8fc70feffe..ec7a30dec7 100644 --- a/lib/err.js +++ b/lib/err.js @@ -1,10 +1,13 @@ +var chalk = require('chalk') + module.exports = function err (error) { console.error('') if (error.host && error.path) { console.error('' + error.message) console.error('' + error.method + ' ' + error.host + error.path) } else { - console.error('Error: ' + (error.stack || error.message || error)) + console.error(chalk.red(' ! ' + (error.message || error))) } + console.error('') process.exit(1) } diff --git a/lib/install.js b/lib/install.js index 144e078a31..e8ef4fdf93 100644 --- a/lib/install.js +++ b/lib/install.js @@ -63,6 +63,10 @@ module.exports = function install (ctx, pkgSpec, modules, options) { fulldata: undefined } + if (!pkg.spec.name) { + throw new Error("Not supported: '" + pkgSpec + "'") + } + var paths = { // Module storage => './node_modules' modules: modules,