Skip to content
This repository has been archived by the owner on Jul 6, 2019. It is now read-only.

Commit

Permalink
fix(call): only npm run env if package.json exists
Browse files Browse the repository at this point in the history
Fixes: #72
  • Loading branch information
zkat committed Jul 12, 2017
1 parent d531206 commit 370f395
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function npx (argv) {
// we take a bit of extra time to pick up npm's full lifecycle script
// environment (so you can use `$npm_package_xxxxx` and company).
// Without that flag, we just use the current env.
argv.call && getEnv(argv)
argv.call && local && getEnv(argv)
]).then(args => {
const existing = args[0]
const newEnv = args[1]
Expand Down Expand Up @@ -115,7 +115,10 @@ function npx (argv) {
module.exports._localBinPath = localBinPath
function localBinPath (cwd) {
return require('./get-prefix.js')(cwd).then(prefix => {
return path.join(prefix, 'node_modules', '.bin')
return promisify(fs.stat)('package.json').then(
() => path.join(prefix, 'node_modules', '.bin'),
err => { if (err.code !== 'ENOENT') throw err }
)
})
}

Expand Down

0 comments on commit 370f395

Please sign in to comment.