Rewrite rules stopped working from npx on Windows
See original GitHub issueI’m running on windows 10. I used to be able to supply command-line parameters for rewrite rules but today I ran into problems.
Windows is interpreting the “>” character in the rewrite rule as being the option to redirect output to a separate file, like you would here:
dir > files.txt
The most basic case that shows this is:
npx ws -r "/a -> /b"
The response I get is “Access is denied.” which is Windows complaining about trying to write to /b.
There doesn’t seem to be a way to escape the >
character, so I’ve opted to use a lws.config.js
config file instead, which solves the problem.
I’d suggest adding something about this to your wiki, as the Rewrite tutorial only mentions Windows needing double quotes instead of single quotes while in my case none of the inline examples work. It’d help others avoid the troubleshooting I had to go through.
Otherwise, I think your module is really useful. Thanks for making it!
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (5 by maintainers)
Top GitHub Comments
@kenlyon ok, thanks for confirming… I have added a note to the top of the rewrite tutorial as suggested and will leave this issue open for a while. 👍
@75lb I can confirm that it does indeed work. Based on the Previous Releases page for node/npm, I confirmed it was still an issue with node 15.51.1 / npm 7.3.0. However, the next release (node 15.6.0 / npm 7.4.0) worked fine.
It’s not really a viable solution for my use case, though, because we’re using the LTS version and it wouldn’t be trivial to switch to the “Current” track at this time. As I mentioned above, I’m fine with using the separate config file.
In addition, I confirmed it’s still a problem in the latest LTS version. (node 14.17.0 / npm 6.14.13)