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

(@aws-cdk/aws-lambda-nodejs): fails on Windows when using pnpm #27654

Open
brno32 opened this issue Oct 23, 2023 · 3 comments
Open

(@aws-cdk/aws-lambda-nodejs): fails on Windows when using pnpm #27654

brno32 opened this issue Oct 23, 2023 · 3 comments
Labels
@aws-cdk/aws-lambda-nodejs bug This issue is a bug. effort/small Small work item – less than a day of effort os/windows Related specifically to Windows behavior p2

Comments

@brno32
Copy link

brno32 commented Oct 23, 2023

Describe the bug

I've installed pnpm on Windows using the following method from the docs https://pnpm.io/installation#on-windows

iwr https://get.pnpm.io/install.ps1 -useb | iex

this makes the command pnpm work in both Command Prompt and PowerShell. However the following line of code appends .cmd to the pnpm command

os.platform() === 'win32' ? `${runCommand}.cmd` : runCommand,

Expected Behavior

for bundling to pass without errors

Current Behavior

Instead of pnpm.cmd, it should just invoke pnpm. Otherwise, when running cdk deploy with a node js lambda using pnpm as a package manager, you get the follow error during bundling

'pnpm.cmd' is not recognized as an internal or external command,
operable program or batch file.

Reproduction Steps

I've tried reproducing this in an isolated project but it didn't trigger the error, so I'm struggling to find out what scenario triggers pnpm.cmd to be fed to the shell

Possible Solution

Instead of pnpm.cmd, runBinCommand should just invoke pnpm when on Windows

Additional Information/Context

No response

CDK CLI Version

2.102.0

Framework Version

2.102.0

Node.js Version

v18.18.0

OS

Windows 11

Language

TypeScript

Language Version

5.2.2

Other information

No response

@brno32 brno32 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Oct 23, 2023
@peterwoodworth peterwoodworth added p1 needs-review effort/small Small work item – less than a day of effort and removed needs-triage This issue or PR still needs to be triaged. labels Oct 26, 2023
@peterwoodworth
Copy link
Contributor

Hey, thanks for reporting this bug, and for linking to the code that might be causing this. We'll take a more in-depth look soon and get back to you

@scanlonp scanlonp added p1 os/windows Related specifically to Windows behavior and removed p2 labels Nov 1, 2023
@khushail
Copy link
Contributor

khushail commented Nov 1, 2023

Hey @brno32 , thanks for reporting this. This needs to be taken into consideration, so marked as P1. However contributions from the community are welcome.

@thesobercoder
Copy link

For anyone facing the same issue, a workaround is to install PNPM as a dev dependency for the moment.

@pahud pahud added p2 and removed p1 labels Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-lambda-nodejs bug This issue is a bug. effort/small Small work item – less than a day of effort os/windows Related specifically to Windows behavior p2
Projects
None yet
Development

No branches or pull requests

6 participants