diff options
author | FallenRiteMonk <fallenritemonk@gmail.com> | 2018-04-05 11:52:34 -0400 |
---|---|---|
committer | Myles Borins <mylesborins@google.com> | 2018-04-05 16:01:07 -0400 |
commit | 25a816dcda7b1db0929501acfe13f2fe5119759b (patch) | |
tree | d3df4377a11dfb643b5976d2048d9bb4ee527903 /deps/npm/node_modules/libnpx/index.js | |
parent | b29c36b80746733994257b7380245102bc3c4cd6 (diff) | |
download | android-node-v8-25a816dcda7b1db0929501acfe13f2fe5119759b.tar.gz android-node-v8-25a816dcda7b1db0929501acfe13f2fe5119759b.tar.bz2 android-node-v8-25a816dcda7b1db0929501acfe13f2fe5119759b.zip |
deps: upgrade npm to 5.8.0
PR-URL: https://github.com/nodejs/node/pull/19560
Fixes: https://github.com/nodejs/node/issues/19271
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Diffstat (limited to 'deps/npm/node_modules/libnpx/index.js')
-rw-r--r-- | deps/npm/node_modules/libnpx/index.js | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/deps/npm/node_modules/libnpx/index.js b/deps/npm/node_modules/libnpx/index.js index 3033e9cd06..e65cd7207b 100644 --- a/deps/npm/node_modules/libnpx/index.js +++ b/deps/npm/node_modules/libnpx/index.js @@ -86,6 +86,9 @@ function npx (argv) { if (process.platform === 'win32') { bins = bins.filter(b => b !== 'etc' && b !== 'node_modules') } + if (bins.length < 1) { + throw new Error(Y()`command not found: ${argv.command}`) + } 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]) @@ -116,11 +119,7 @@ function npx (argv) { module.exports._localBinPath = localBinPath function localBinPath (cwd) { return require('./get-prefix.js')(cwd).then(prefix => { - const pkgjson = path.join(prefix, 'package.json') - return promisify(fs.stat)(pkgjson).then( - () => path.join(prefix, 'node_modules', '.bin'), - err => { if (err.code !== 'ENOENT') throw err } - ) + return prefix && path.join(prefix, 'node_modules', '.bin') }) } @@ -146,8 +145,8 @@ function ensurePackages (specs, opts) { ).then(cache => { const prefix = path.join(cache, '_npx', process.pid.toString()) const bins = process.platform === 'win32' - ? prefix - : path.join(prefix, 'bin') + ? prefix + : path.join(prefix, 'bin') const rimraf = require('rimraf') process.on('exit', () => rimraf.sync(prefix)) return promisify(rimraf)(bins).then(() => { @@ -224,8 +223,8 @@ function installPackages (specs, prefix, opts) { if (npmPath) { args.unshift( process.platform === 'win32' - ? child.escapeArg(opts.npm) - : opts.npm + ? child.escapeArg(opts.npm) + : opts.npm ) return process.argv[0] } else { @@ -355,7 +354,7 @@ function findNodeScript (existing, opts) { return str.match(cmd) || str.match(mingw) }).then(match => { return match && path.join(path.dirname(existing), match[1]) - }).then(x => console.log(x) || x) + }) } }) } |