Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnhandledPromiseRejectionWarning: SyntaxError: Invalid regular expression #293

Closed
jmfayard opened this issue May 14, 2021 · 3 comments
Closed

Comments

@jmfayard
Copy link
Contributor

jmfayard commented May 14, 2021

Hello,
I am using CliKt here
https://github.com/jmfayard/kotlin-cli-starter/blob/node-windows/src/commonMain/kotlin/cli/CliCommand.kt#L23-L84

It works fine on native and on the JVM, but it fails systematically on Node JS (legacy)

(node:13328) UnhandledPromiseRejectionWarning: 
SyntaxError: Invalid regular expression: /[!"#$%&'()*+,-./\\:;<=>?@\[\]^_`{|}~]{1,2}[\w-_]+/: 
Invalid character class
    at new RegExp (<anonymous>)
    at Regex (/Users/jmfayard/IdeaProjects/kotlin-cli-starter/build/js/node_modules/kotlin/kotlin/text/regex.kt:54:41)
    at Regex_init_0 (/Users/jmfayard/IdeaProjects/kotlin-cli-starter/build/js/node_modules/kotlin/kotlin/text/regex.kt:47:50)
    at inferOptionNames (/Users/jmfayard/IdeaProjects/clikt/src/commonMain/kotlin/com/github/ajalt/clikt/parameters/options/Option.kt:92:52)
    at OptionWithValues.provideDelegate_16fg2h$ (/Users/jmfayard/IdeaProjects/clikt/src/commonMain/kotlin/com/github/ajalt/clikt/parameters/options/OptionWithValues.kt:156:17)
    at new CliCommand (/Users/jmfayard/IdeaProjects/kotlin-cli-starter/src/commonMain/kotlin/cli/CliCommand.kt:40:30)

See https://scans.gradle.com/s/t5vmumjkiblcc/console-log?anchor=27

@ajalt
Copy link
Owner

ajalt commented May 14, 2021

Reported this Kotlin bug in KT-46694. I'll add a workaround in the meantime.

@ajalt
Copy link
Owner

ajalt commented May 14, 2021

3.2.0 has been released with a workaround for this bug.

@ajalt ajalt closed this as completed May 14, 2021
@jmfayard
Copy link
Contributor Author

works like a charm, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants