Skip to content

Commit

Permalink
Added - cwd option to npm install command (#265)
Browse files Browse the repository at this point in the history
* Added `- cwd` option to `npm install` command

Because `Refusing to install node - lambda as a dependency of itself`
error occurs on Windows

* Fix to add `--cwd` option only for Windows
  • Loading branch information
abetomo authored and DeviaVir committed May 8, 2017
1 parent ce12f9d commit 428a0ab
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,13 @@ Lambda.prototype._rsync = function (program, src, dest, excludeNodeModules, call
};

Lambda.prototype._npmInstall = function (program, codeDirectory, callback) {
const installOptions = [
`--prefix ${codeDirectory}`,
process.platform === 'win32' ? `--cwd ${codeDirectory}` : null,
].join(' ');
var command = program.dockerImage ?
'docker run --rm -v ' + codeDirectory + ':/var/task ' + program.dockerImage + ' npm -s install --production' :
'npm -s install --production --prefix ' + codeDirectory;
`npm -s install --production ${installOptions}`;
exec(command, {
maxBuffer: maxBufferSize,
env: process.env
Expand Down

0 comments on commit 428a0ab

Please sign in to comment.