-
Notifications
You must be signed in to change notification settings - Fork 479
Expo fails to start the project: error Invalid regular expression: /(.*\\__fixtures__ #1074
Comments
same here |
Fixed it by downgrading Node version |
@yuraheiko From what version and to what version of node did you downgrade? |
same here |
I dont remember which version I had, but for me works node 10 LTS. |
Just updated to Node 12.12.0 and got this error. ☹ |
Tried Using expo-cli 3.3.0. |
i just start react native using expo cli .. and get this error and im confused.. Metro Bundler process exited with code 1 npm ERR! A complete log of this run can be found in: |
I had this error too, downgraded to 10.16.3 and it's working. |
Qual o comando que vcs usam para voltar versão sem dar erro? usei o comando cinst nodejs.install --force -version 12.9 -allow-downgrade e não obtive sucesso, está dando erro Failures
|
I had the node v12.12.0 (just recently via
This downgrade fixed that:
|
how can I uninstall nodejs with npm? |
Just updated to Node 12.12.0 and got this error. ☹ |
Thank you! I had everything working on my MacBook Pro and my Windows 10 laptop but could not, for the life of me, get things working on my desktop Windows 10 machine. Sure enough, |
Got this issue today on windows, but don't need to downgrade node, just as discussed on stackoverflow just need to change some hashes on your project:
change to:
Hope it works like worked for me :) |
Thank you @hadessama1994! Changing the value of the sharedBlackList variable in metro config src worked for me on windows 10. Just downloaded node 12.13.0 and did not have to downgrade. |
@hadessama1994 This worked for me too. To think a single character escape is the issue xD. |
@hadessama1994 Muito obrigado companheiro !! |
Thank's a lot , it works for me |
It's more a crutch rather than a good solution. It will work until the |
Summary: **Summary** On Windows with Node.js v12.x.x, Metro crashes with ``` SyntaxError: Invalid regular expression: /(.*\\__fixtures__\\.*|node_modules[\\\]react[\\\]dist[\\\].*|website\\node_modules\\.*|heapCapture\\bundle\.js|.*\\__tests__\\.*)$/: Unterminated character class ``` This has been reported in #453, facebook/react-native#26829, facebook/react-native#26969, facebook/react-native#26878, facebook/react-native#26598, expo/expo-cli#1147 and expo/expo-cli#1074. There are a few open pull requests attempting to fix this same issue: * #464 * #461 * #458 * #454 However, none of the existing PRs address the *root cause* of this error: the `escapeRegExp` function in `blacklist.js` tries to convert regular expressions to be agnostic to the path separator ("/" or "\\"), but turns some valid regular expressions to invalid syntax. The error was is this line: https://github.com/facebook/metro/blob/142348f5345e40ce2075fc7f9dfa30c5d31fee2a/packages/metro-config/src/defaults/blacklist.js#L28 When given a regular expression, such as `/node_modules[/\\]react[/\\]dist[/\\].*/`, on Windows where `path.sep` is `\` (which is also an escape character in regular expressions), this gets turned into `/node_modules[\\\]react[\\\]dist[\\\].*/`, resulting in the `Unterminated character class` error. Automatically replacing `[/]` with `[\]` is an error, as is replacing `[\/]` with `[\\]`, because in both of these cases the backslash before the end of character class "]" escapes it, and the character class becomes unterminated. Therefore, this PR changes the code to look for both escaped forward slash `\/` and forward slash `/`, and always replace them with the escaped version (`\/` or `\\`, depending on the platform). This fixes #453. **Test plan** Added a test case that exercises the code with both `\` and `/` as path separators. Pull Request resolved: #468 Differential Revision: D18201730 Pulled By: cpojer fbshipit-source-id: 6bb694178314c39d4d6a0fd9f8547bfa2c36f894
error Invalid regular expression: /(.\fixtures\.|node_modules[\]react[\]dist[\].|website\node_modules\.|heapCapture\bundle.js|.\tests\.)$/: Unterminated character class. Run CLI with --verbose flag for more details. Metro Bundler process exited with code 1 |
Thanks worked! :) |
#1074 (comment) |
Same for me. I did 'fix' blacklist.js |
It Works for me on Windows 7 Ultimate. Thank You!!! |
It works. But everytime I add a new package, it has to be done again. Annoying... |
Not For me: E:\Hassan\ReactTutorial\rn-first-app>npm start
\Starting project at E:\Hassan\ReactTutorial\rn-first-app Metro Bundler process exited with code 1 npm ERR! A complete log of this run can be found in: E:\Hassan\ReactTutorial\rn-first-app> |
The underlying Metro issue has been fixed upstream in facebook/metro@7c6f30b. |
Install Nodejs node-v10.15.3 it should resolve the issue. |
Had the same problem (with nodejs 12.13.0). |
Another confirmation that the fix to blacklist.js worked. I CRINGE every time I'm prompted to update expo-cli. Unlike every other package I use, it's never simple and/or flawless. |
@tim92109 - in this case the error that you appear to be encountering is not actually from expo-cli but from tools that underly it: node and metro (the react-native packager). as you can see from this stackoverflow post this error happens on any react-native project. further, the maintainer of expo-cli (@fson) actually went and fixed the bug in metro itself (facebook/metro@7c6f30b), which he does not maintain. so i don't think it's really fair to blame expo-cli here. |
Have the latest node JS 13.1.0 but same error |
Thanks I was about to go crazy;)
El mié., 20 nov. 2019 a las 23:38, nzrubin (<notifications@github.com>)
escribió:
… Great Thanks!
adjusting as advised above
\node_modules\metro-config\src\defaults\blacklist.js
worked for me
W10 Node 13.1.0
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1074?email_source=notifications&email_token=AL72SHK2MRDVZB6REC6472DQUXYCRA5CNFSM4I5ZR67KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEYRX2Q#issuecomment-556866538>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AL72SHI3CBWXZ7B74WSKHTTQUXYCRANCNFSM4I5ZR67A>
.
|
finally i could did this thanks to you! |
@lucasgit2000 's solution worked for me. Thanks mate. Edit: running nodejs v12.13.1 (I didn’t downgrade) |
Worked for me!! |
How did you solve this? |
@rahul12330 instructions here: #1074 (comment) |
see this stack overflow discussion
this to
Note:: each time you do npm install do update the file |
Real bummer about Expo which is the only reason I sometimes don't like developing in React. Last 5 expo updates caused issues including this one. HATE it when I see a new version of Expo is available. Wish they would at least test new versions before pushing them. |
Must downgrade to 12.9.1 version of Node.js ... I think that is the latest version that works without crashing... here is the download link: |
after node downgrade i further did npm uninstall --g expo-cli to be able to compile my code I did not make change into any local node module. Everything worked. |
@hadessama1994 thank you so much :) |
that why from my child hood i believed in Microsoft, you hardly found a functionally that get remove and cause old code to crash, you still can run and use codes from hundred of years ago :-" |
Have you even used Windows 10? |
@fson It's a pity no one's picking up your real solution here but adding more noise to the comments. Any chance to get your fix without requiring someone updating this repo's dependencies first? |
👋 if you came here from the expo-cli warning. the recommended solution is to do the following:
the important thing is that when you install your dependencies you end up with metro@0.56.4 or greater in your lockfile! does this now work for you for some reason? other temporary solutions if you encounter this error are: option 1. downgrade to node 12.9 if you are curious why you are seeing this error, it is because a specific version of a package called metro-config (a package used by react-native) has some code that is incompatible with certain versions of node 12. |
Description
I just initialize a new expo project and try to start it, but every time I get this error. This also happens with all my expo projects on this machine.
Expected Behavior
I use
yarn start
and expect expo to start the project.Observed Behavior
Environment
The text was updated successfully, but these errors were encountered: