diff --git a/test/parallel/test-npm-install.js b/test/parallel/test-npm-install.js index b6ef67bf322ea3..c716e48aefedab 100644 --- a/test/parallel/test-npm-install.js +++ b/test/parallel/test-npm-install.js @@ -32,11 +32,12 @@ const pkgPath = path.join(common.tmpDir, 'package.json'); fs.writeFileSync(pkgPath, pkgContent); +const env = Object.create(process.env); +env['PATH'] = path.dirname(process.execPath); + const proc = spawn(process.execPath, args, { cwd: common.tmpDir, - env: { - PATH: path.dirname(process.execPath) - } + env: env }); function handleExit(code, signalCode) {