每个项目都运行良好,直到出现此错误为止。我不知道这是由于节点升级所致;我尝试通过将节点从最新版本降级到稳定版本,但是没有任何效果! 我使用 yarn start
运行react native项目Err: 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
Set EXPO_DEBUG=true in your env to view the stack trace.
答案 0 :(得分:1)
自从上一个答案以来,事情似乎已经改变,这是行不通的。打开文件PROJECT_NAME \ node_modules \ metro-config \ src \ defaults \ blacklist.js
并将当前的var sharedBlacklist
替换为此:
var sharedBlacklist = [/node_modules[\/\\]react[\/\\]dist[\/\\].*/,/website\/node_modules\/.*/,/heapCapture\/bundle\.js/,/.*\/__tests__\/.*/];
答案 1 :(得分:0)
转到node_modules-> Metro-config-> src->默认-> blacklist.js
查找此数组:
var sharedBlacklist = [
/node_modules[/\\]react[/\\]dist[/\\].*/,
/website\/node_modules\/.*/,
/heapCapture\/bundle\.js/,
/.*\/__tests__\
];
并替换为此
var sharedBlacklist = [
/node_modules[\/\\]react[\/\\]dist[\/\\].*/,
/website\/node_modules\/.*/,
/heapCapture\/bundle\.js/,
/.*\/__tests__\
];
答案 2 :(得分:0)
转到此文件 node_modules > Metro-config > src > defaults > blacklist.js
并找到
var sharedBlacklist = [
/node_modules[/\\]react[/\\]dist[/\\].*/,
/website\/node_modules\/.*/,
/heapCapture\/bundle\.js/,
/.*\/__tests__\/.*/
];
并以此更新
var sharedBlacklist = [
/node_modules[\/\\]react[\/\\]dist[\/\\].*/,
/website\/node_modules\/.*/,
/heapCapture\/bundle\.js/,
/.*\/__tests__\/.*/
];