wrangler-action: Error Installing Wrangler with pnpm
This error started happening in the latest version
📥 Installing Wrangler
Running command: pnpm add wrangler@3.5.1
Error: Command failed: pnpm add wrangler@3.5.1
Error: 🚨 Action failed
About this issue
- Original URL
- State: open
- Created 9 months ago
- Comments: 15 (6 by maintainers)
@thantos thanks for investigating. It looks like there are two distinct problems here:
-wflag in the install command causes pnpm to errorI’ll keep this issue open to track the first problem. Installation error stdout being swallowed should be addressed by #171. I’ll also open a new issue to track installing wrangler only when it’s not already installed. (#199)
This workaround isn’t working for me.
I have opened a PR with an attempt to fix this: https://github.com/cloudflare/wrangler-action/pull/207
@1000hz let me know if my approach is on the right track.
I was able to work around this issue with a pretty simple change, just by setting
packageManager: pnpmnear theworkingDirectoryproperty:The issue indeed is because of getPackageManager function tries to retrieve
packageManagerfrom detectPackageManager(workingDirectory), and whenworkingDirectoryis a subdirectory of workspace (e.g. withoutpnpm-lock.yaml) - it results in an error. So explicitly settingpackageManager: pnpm- solves this issue.P.S: Also, I think it’s a good idea to mention this in the docs or troubleshooting, as nowadays many projects use workspaces.
Done - https://github.com/cloudflare/wrangler-action/issues/198
@AdiRishi yes, please open a new issue for that
I just ran into this myself. For me I think the special case was that I’m using the
workingDirectorypropertyMy suspicion is that it is looking for
pnpm-lock.yamlwhich doesn’t exist when running in the subdirectory. To be clear, this is running in a monorepo setup (using turborepo). The exact error message is