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

'SyntaxError: invalid identity escape in regular expression' in Firefox after upgrading to v6.0.0 #63

Closed
apasov opened this issue Apr 7, 2020 · 6 comments

Comments

@apasov
Copy link

apasov commented Apr 7, 2020

I get this error in Firefox only:
SyntaxError: invalid identity escape in regular expression
though in Chrome it works okay.
image

Steps to reproduce:

git clone https://github.com/apasov/animatable-properties.git
cd animatable-properties
git reset --hard 3728a084984482ddcfc6a096a38c9b4c10a8c270

then open index.html in Firefox and you'll see blank page and the error in console.

After this commit fix: downgrade to camelcase v5.3.1 to fix syntax error in Firefox which fixes the error

git reset --hard cd3bda8f6a5972e7af4a71c5b65a3616c2852b01

reload index.html and it works as intended without errors

@sindresorhus
Copy link
Owner

@EthanSbbn Your issue is just that you didn't read the release notes which clearly state that Node.js 10 is required now.

@sindresorhus
Copy link
Owner

No, it’s expected that you read release notes. Especially for major versions.

@phun-ky
Copy link

phun-ky commented May 12, 2020

@sindresorhus I have nodejs 12.16.3, and I get:

SyntaxError: invalid identity escape in regular expression

In firefox, with v6, but will downgrade. So it's not just a "You need a newer node version" issue. Perhaps specify that this is a ES2018 issue?

@sindresorhus
Copy link
Owner

@phun-ky Tests are passing on 12.16.3: https://travis-ci.com/github/sindresorhus/camelcase/jobs/321547607 You probably have multiple Node.js versions installed.

@phun-ky
Copy link

phun-ky commented May 12, 2020

Hm, I use nvm, but the package is built / installed with the current node version active, as per spec right? For example, node sass (deps? ) needs to be recompiled/installed if you change versions.

Is not an issue for me, but dont be hasty saying that everything works just because the test passes.

@ThiefMaster
Copy link

ThiefMaster commented May 21, 2020

SyntaxError: Invalid regular expression: /[_.\- ]+([\p{Alpha}\p{N}_]|$)/: Invalid property name in character class
    at camelCase (/home/adrian/dev/indico/src/node_modules/jest-validate/node_modules/camelcase/index.js:69:3)

With nodejs 12.16.1 on Gentoo. I'm not using nvm so it is not a case of using an older/different node version.

Also reproducible standalone:

[adrian@blackhole:/tmp]> node
Welcome to Node.js v12.16.1.
Type ".help" for more information.
> x = /[_.\- ]+([\p{Alpha}\p{N}_]|$)/gu;
Uncaught:
SyntaxError: Invalid regular expression: /[_.\- ]+([\p{Alpha}\p{N}_]|$)/: Invalid property name in character class

Oddly enough, in a node:12.6 docker container it works:

Welcome to Node.js v12.6.0.
Type ".help" for more information.
> x = /[_.\- ]+([\p{Alpha}\p{N}_]|$)/gu;
/[_.\- ]+([\p{Alpha}\p{N}_]|$)/gu

Update: I found out why it's failing: Node on Gentoo does not enable the icu USE flag by default, so when it compiles nodejs without libicu, the error above happens.

dobo90 added a commit to dobo90/packages that referenced this issue Feb 12, 2021
adguardhome (v0.105.0) compilation fails because of the following error:

  .../webpack/lib/cli.js:66
  .replace(
  ^

  SyntaxError: Invalid regular expression: /(\p{Uppercase_Letter}+|\p{Lowercase_Letter}|\d)(\p{Uppercase_Letter}+)/: Invalid escape

After googling the issue it came out that nodejs has to be compiled with
icu support enabled [1].

According to the nodejs documentation, small icu do not need any
dependencies to download [2]. ldd command doesn't reveal any new shared
libraries linked into the node binary.

After applying following changes adguardhome's compilation went flawlessly.

[1]: sindresorhus/camelcase#63 (comment)
[2]: https://github.com/nodejs/node/blob/f2c26153d79564afe893d8135be616af402d0136/BUILDING.md#trimmed-small-icu-english-only-support

Signed-off-by: Dobroslaw Kijowski <dobo90@gmail.com>
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

4 participants