Skip to content

Commit 75e9a3e

Browse files
committed
Installing from local directory, npm will set process.env.INIT_CWD to the app path, and symlink to the postinstall scripts will be resolved in __dirname
1 parent db91878 commit 75e9a3e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ function generateHookName(pkg, hook) {
2424
}
2525

2626
function findProjectDir(pkgdir) {
27+
if (process.env.INIT_CWD) {
28+
return process.env.INIT_CWD;
29+
}
30+
2731
var candidateDir = pkgdir;
2832

2933
while (true) {

0 commit comments

Comments
 (0)