From 1e0017325fc8cf658263fb4e02c7bf8912f422b3 Mon Sep 17 00:00:00 2001 From: vince Date: Mon, 26 Feb 2018 14:45:34 +0100 Subject: [PATCH] fix: #3456 use homedir() instead of process.env.HOME, make module installation work on windows --- lib/API/Modules/Modularizer.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/API/Modules/Modularizer.js b/lib/API/Modules/Modularizer.js index 7093324bf..e738255ed 100644 --- a/lib/API/Modules/Modularizer.js +++ b/lib/API/Modules/Modularizer.js @@ -6,6 +6,7 @@ var shelljs = require('shelljs'); var path = require('path'); var fs = require('fs'); +var os = require('os'); var async = require('async'); var p = path; var readline = require('readline'); @@ -185,7 +186,7 @@ Modularizer.installModule = function(CLI, module_name, opts, cb) { var install_path = path.join(cst.DEFAULT_MODULE_PATH, canonic_module_name); mkdirp(install_path, function() { - process.chdir(process.env.HOME); + process.chdir(os.homedir()); var install_instance = spawn(cst.IS_WINDOWS ? 'npm.cmd' : 'npm', ['install', module_name, '--loglevel=error', '--prefix', install_path ], { stdio : 'inherit',