question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rewrite rules stopped working from npx on Windows

See original GitHub issue

I’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:closed
  • Created 3 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
75lbcommented, May 14, 2021

@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. 👍

0reactions
kenlyoncommented, May 14, 2021

@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)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rewrite rules stopped working from npx on Windows #165
I'm running on windows 10. I used to be able to supply command-line parameters for rewrite rules but today I ran into problems....
Read more >
Using Failed Request Tracing to Trace Rewrite Rules
This walkthrough will guide you through how to use FRT to troubleshoot and debug URL rewriting rules.
Read more >
npx command not found - node.js - Stack Overflow
I found that when I install node using nvm for Windows, it doesn't download npx. so just install npx globally: npm i -g...
Read more >
Common errors | npm Docs
Possible temporary npm registry glitch, or corrupted local server cache. Run npm cache clean and/or try again later. · This can be caused...
Read more >
React JavaScript Tutorial in Visual Studio Code
vscode folder in your project which includes a configuration to launch the website. We need to make one change for our example: change...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found