From 75e9a3ebc7dad4c272a97a8c0b0a9edce78823a8 Mon Sep 17 00:00:00 2001 From: Panayot Cankov Date: Wed, 18 Oct 2017 17:53:01 +0300 Subject: [PATCH] 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 --- index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.js b/index.js index 3ae1f2a..c8f6183 100644 --- a/index.js +++ b/index.js @@ -24,6 +24,10 @@ function generateHookName(pkg, hook) { } function findProjectDir(pkgdir) { + if (process.env.INIT_CWD) { + return process.env.INIT_CWD; + } + var candidateDir = pkgdir; while (true) {