workers-sdk: 🐛 BUG: `wrangler pages dev -- npm run serve` gives an "Unknown argument" error
What version of Wrangler are you using?
2.0.2
What operating system are you using?
Windows
Describe the Bug
I am currently giving WebStorm a try and I am encountering a problem when running the command below:
wrangler pages dev --proxy 8080 -- npm run serve
Indeed, when this command is executed via a classic Command Prompt, everything works fine, but when it is executed from PowerShell, the following error is displayed:

The command npm run serve works correctly.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 29 (16 by maintainers)
Commits related to this issue
- fix: pages "command" can consist of multiple words On Windows, the following command `wrangler pages dev -- foo bar` would error saying that `bar` was not a known argument. This is because `foo` and ... — committed to petebacondarwin/wrangler2 by petebacondarwin 2 years ago
- fix: pages "command" can consist of multiple words On Windows, the following command `wrangler pages dev -- foo bar` would error saying that `bar` was not a known argument. This is because `foo` and ... — committed to petebacondarwin/wrangler2 by petebacondarwin 2 years ago
- fix: pages "command" can consist of multiple words (#1057) On Windows, the following command `wrangler pages dev -- foo bar` would error saying that `bar` was not a known argument. This is because `... — committed to cloudflare/workers-sdk by petebacondarwin 2 years ago
I am not sure why the behaviour is different between command prompts. I guess different prompts pass the args in in different ways at the OS level?? Anyway, my PR (#1057) should be a reliable fix across all, and is arguably the right way to do this anyway.
I just tried starting wrangler with npx, and the command works just fine when doing so. The command only fails when running wrangler using the wrangler command.
Can confirm this is a bug since I am also having the same issue.
Using wrangler@2.0.3 and:
I have this problem when I try to run the command just after cloning this project (so you can try by yourself): https://github.com/Flotss/maxouxax.me