From 5757b0820ecaba1ca7f6ce76ad12527acc42f46a Mon Sep 17 00:00:00 2001 From: joey91133 Date: Wed, 13 Mar 2019 16:01:00 +0800 Subject: [PATCH] fix some Windows crash problem. --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 1defb68..2663fed 100644 --- a/index.js +++ b/index.js @@ -11,6 +11,7 @@ const fs = require('fs'); const os = require('os'); const path = require('path'); const ini = require('ini'); +const which = require('which'); let prefix; const getPrefix = () => { @@ -64,7 +65,7 @@ const getPrefix = () => { function tryNpmPath() { try { - return fs.realpathSync(require('which').sync('npm')); + return fs.realpathSync(which.sync('npm')); } catch (err) { /* do nothing */ } }