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.

flow-typed v2.2.0 fails on windows

See original GitHub issue
npx flow-typed
...\node_modules\flow-typed\dist\cli.js
Invalid regular expression: /definitions\npm\(@[^\]*\)?[^\]*\?/: Unterminated character class

It doesn’t matter what commands I run and what folder I run them in - end result is the same.

  • node v8.1.2
  • Windows 10 x64

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

11reactions
kyrylkovcommented, Oct 10, 2017

@marudor any update?

5reactions
kulmajabacommented, Oct 6, 2017

Same issue for me on Windows.

The issue is in \dist\commands\runTests.js line 70:

var basePathRegex = new RegExp('definitions' + _node.path.sep + 'npm' + _node.path.sep + '(@[^' + _node.path.sep + ']*' + _node.path.sep + ')?[^' + _node.path.sep + ']*' + _node.path.sep + '?');

On Windows, _node.path.sep is \ but it’s also the escape symbol, so the symbols have to be double-escaped: \\\\

Another option is to use / for Windows as well. From Node.js docs:

Note: On Windows, both the forward slash (/) and backward slash (\) are accepted as path segment separators; however, the path methods only add backward slashes (\).

Both options worked for me in Windows, testing in Command Prompt, Node.js Command Prompt and Git Bash.

Which approach should we take? And if we go for the double-escaped backslashes, how can we do it neatly in the code?

If someone can point me to the right direction I can submit a PR.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Latest version of flow-typed cli can't run "flow-typed install"
I'm currently running an older version of flow-typed and whenever I install a new dep I would run flow-typed install and it would...
Read more >
Flow failing Randomly - Condition 2 fails to to BadRequest
According to the error, the Flow is not able to open the File but it looks like the File is already created. I...
Read more >
Error: Invalid npm libdef version! It appears to be a non ...
The issue is caused by a loose dependency of flow-typed cli (semver) that broke the flow-typed installer. This has been fixed and we've ......
Read more >
Windows Support - Flow: A Static Type Checker for JavaScript
Try it out and report any issues you come across! Getting Flow working on Windows was not easy, and it was made possible...
Read more >
flow-typed | Yarn - Package Manager
A repository of high-quality, third-party library type definitions for use with Flow. ci status npm package docs discord package health ...
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