windows 电脑 执行 react-native 项目,报错如下

苗运珧
2023-12-01

windows 电脑 执行 react-native 项目,报错如下:
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.

解决方法 :
找到这个文件:

\node_modules\metro-config\src\defaults\blacklist.js

替换内容为:

var sharedBlacklist = [
  /node_modules[\/\\]react[\/\\]dist[\/\\].*/,
  /website\/node_modules\/.*/,
  /heapCapture\/bundle\.js/,
  /.*\/__tests__\/.*/
];
 类似资料: