Skip to content

Commit c6307c2

Browse files
committed
[Fix] bin/resolve: allow npx resolve usage
1 parent 6f2b872 commit c6307c2

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

bin/resolve

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@ var path = require('path');
66
var fs = require('fs');
77

88
if (
9-
!process.argv
10-
|| process.argv.length < 2
11-
|| (process.argv[1] !== __filename && fs.statSync(process.argv[1]).ino !== fs.statSync(__filename).ino)
12-
|| (process.env._ && path.resolve(process.env._) !== __filename)
9+
String(process.env.npm_lifecycle_script).slice(0, 8) !== 'resolve '
10+
&& (
11+
!process.argv
12+
|| process.argv.length < 2
13+
|| (process.argv[1] !== __filename && fs.statSync(process.argv[1]).ino !== fs.statSync(__filename).ino)
14+
|| (process.env._ && path.resolve(process.env._) !== __filename)
15+
)
1316
) {
1417
console.error('Error: `resolve` must be run directly as an executable');
1518
process.exit(1);

0 commit comments

Comments
 (0)