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.

CLI not working on Windows

See original GitHub issue

The CLI is not working for me on Windows, and the issue seems to be with this code:

https://github.com/avajs/ava/blob/f9fe8f242dd58d02ab1110f677e82172652d9d3d/cli.js#L11-L15

if (localCLI && localCLI !== __filename) {
    debug('Using local install of AVA');
    require(localCLI);
    return;
}

The problem is with the use of !== to compare localCLI and __filename. In my case, the two variables hold the following values:

localCLI: c:\workspace\...\node_modules\ava\cli.js __filename: C:\workspace\...\node_modules\ava\cli.js

As you can see, the drive letter c: is lowercase in localCLI and uppercase in __filename, thus failing the !== check.

Using !== to compare paths doesn’t seem to be a particularly good idea since there are numerous different ways the exact same path can be encoded. Not sure what the best practice is for comparing paths in node.js is. Perhaps path.relative() could be used?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
vadimdemedescommented, Aug 9, 2016

Although yes, path.relative would be better.

path.relative(localCLI, __filename) !== ''
0reactions
sindresorhuscommented, Aug 9, 2016
Read more comments on GitHub >

github_iconTop Results From Across the Web

[Fixed] Command Prompt (CMD) Not Working/Opening ...
Fix 1. Restart Your Windows 10 PC; Fix 2. Temporarily Disable Antivirus Software; Fix 3. Modify PATH Environment Variables Settings; Fix 4.
Read more >
Fixed: Command Prompt Not Working in Windows 11/10
Command Prompt is not working in Windows 11/10 ; Fix 1. Use CMD Alternative, Run CMD alternative software > Right-click target partition to...
Read more >
How to Fix Command Prompt(CMD) Not Working ... - YouTube
In this video tutorial, I will show you guys how to fix Windows 10 CMD (Command Prompt) Not working or opening. commands:taskmgrcmd.
Read more >
Troubleshooting AWS CLI errors - AWS Command Line Interface
General troubleshooting to try first · Check your AWS CLI command formatting · Confirm that you're running a recent version of the AWS...
Read more >
Troubleshoot .NET tool usage issues - Microsoft Learn
If you're trying to run a global tool, check that the PATH environment variable on your machine contains the path where you installed...
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