Hi,
1. I just installed node.js & cli
- * installed node.js
npm -g react-native-cli
And created a 'new project'.
react-native init new_project
and inside that 'new_project' directory, I tired to see if metro bundler works well.
react-native start
But the command gives me following error and metro is not starting.
Any clue for fixing this error?
(I'm using windows 10 OS.)
------------------error message I am getting----------------------
C:\projects\new_proj>react-native start
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.
SyntaxError: Invalid regular expression: /(.\__fixtures__\.|node_modules[\]react[\]dist[\].|website\node_modules\.|heapCapture\bundle.js|.\__tests__\.)$/: Unterminated character class
at new RegExp (
at blacklist (D:\projects\new_projnode_modules\metro-config\src\defaults\blacklist.js:34:10)
at getBlacklistRE (D:\projects\new_projnode_modules\react-nativenode_modules\@react-native-community\cli\build\tools\loadMetroConfig.js:69:59)
at getDefaultConfig (D:\projects\new_projnode_modules\react-nativenode_modules\@react-native-community\cli\build\tools\loadMetroConfig.js:85:20)
at load (D:\projects\new_projnode_modules\react-nativenode_modules\@react-native-community\cli\build\tools\loadMetroConfig.js:121:25)
at Object.runServer [as func] (D:\projects\new_projnode_modules\react-nativenode_modules\@react-native-community\cli\build\commands\server\runServer.js:82:58)
at Command.handleAction (D:\projects\new_projnode_modules\react-nativenode_modules\@react-native-community\cli\build\cliEntry.js:160:21)
at Command.listener (D:\projects\new_projnode_modules\commander\index.js:315:8)
at Command.emit (events.js:210:5)
at Command.parseArgs (D:\projects\new_projnode_modules\commander\index.js:651:12)
We are automatically closing this issue because it does not appear to follow any of the provided issue templates.
馃憠 Click here if you want to report a reproducible bug or regression in React Native.
It's caused by node v12.11.0, downgrade to v12.10.0 will solve it.
Yes, maybe it's a bug in the latest v12.11.0 node, see https://stackoverflow.com/questions/58120990/question-getting-error-on-react-native-start# for more details.
O mesmo estava acontecendo comigo, fiz o downgrade do node e funcionou.
It appears in node_modules\metro-config\src\defaults\blacklist.js, there is an invalid regular expression that needed changed. I changed the first expression under sharedBlacklist from:
var sharedBlacklist = [
/node_modules[/\]react[/\]dist[/\]./,
/website\/node_modules\/./,
/heapCapture\/bundle.js/,
/.\/__tests__\/./
];
to:
var sharedBlacklist = [
/node_modules[\/\]react[\/\]dist[\/\]./,
/website\/node_modules\/./,
/heapCapture\/bundle.js/,
/.\/__tests__\/./
];
Yes, it is the bug in the newer version of node.js.
It appears in node_modules\metro-config\src\defaults\blacklist.js, there is an invalid regular expression that needed to be changed. I changed the first expression under sharedBlacklist from:
var sharedBlacklist = [
/node_modules[/\]react[/\]dist[/\]./,
/website\/node_modules\/./,
/heapCapture\/bundle.js/,
/.\/__tests__\/./
];
to:
var sharedBlacklist = [
/node_modules[\/\]react[\/\]dist[\/\]./,
/website\/node_modules\/./,
/heapCapture\/bundle.js/,
/.\/__tests__\/./
];
Go to your Project Foldernode_modules\metro-config\src\defaults\blacklist
Get the changes from attached file:
blacklist.txt
UPDATE
I noticed that the editor here removes the (*) from the code, so I attached a file containing the code.
It works fine now
i had the same issue its work fine for me
V谩 para a pasta do projeto \ node_modules \ metro-config \ src \ defaults \ blacklist
Obtenha as altera莽玫es do arquivo anexado:
blacklist.txtATUALIZA脟脙O
Observei que o editor aqui remove o (*) do c贸digo, ent茫o anexei um arquivo que cont茅m o c贸digo.
Funciona bem agora
very good it works
Thank you; MagedYaseen; Works perfectly : )
var sharedBlacklist = [
/node_modules[\/\]react[\/\]dist[\/\]./,
/website\/node_modules\/./,
/heapCapture\/bundle.js/,
/.\/__tests__\/./
];
Most helpful comment
Go to your Project Foldernode_modules\metro-config\src\defaults\blacklist
Get the changes from attached file:
blacklist.txt
UPDATE
I noticed that the editor here removes the (*) from the code, so I attached a file containing the code.
It works fine now