Skip to content
This repository has been archived by the owner on Apr 7, 2021. It is now read-only.

Commit

Permalink
fix(errors): print command not found for packages without valid binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
zkat committed Jul 11, 2017
1 parent 906574e commit 9b24359
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ function npx (argv) {
const cmd = new RegExp(`^${argv.command}(?:\\.cmd)?$`, 'i')
const matching = bins.find(b => b.match(cmd))
return path.resolve(results.bin, bins[matching] || bins[0])
}, err => {
if (err.code === 'ENOENT') {
throw new Error(Y()`command not found: ${argv.command}`)
} else {
throw err
}
})
} else {
return existing
Expand Down

0 comments on commit 9b24359

Please sign in to comment.