Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: skip installing the package, when there is no package.json #589

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,11 @@ Emulate only the body of the API Gateway event.
}

_packageInstall (program, codeDirectory) {
if (!fs.existsSync(path.join(codeDirectory, 'package.json'))) {
console.log('Skip the installation of the package. (Because package.json is not found.)')
return
}

// Run on windows:
// https://nodejs.org/api/child_process.html#child_process_spawning_bat_and_cmd_files_on_windows

Expand Down Expand Up @@ -729,7 +734,9 @@ they may not work as expected in the Lambda environment.
if (!program.keepNodeModules) {
console.log('=> Running package install')
const usedPackageManager = await this._packageInstall(program, codeDirectory)
console.log(`(Package manager used was '${usedPackageManager}'.)`)
if (usedPackageManager) {
console.log(`(Package manager used was '${usedPackageManager}'.)`)
}
}
await this._postInstallScript(program, codeDirectory)
console.log('=> Zipping deployment package')
Expand Down