【问题标题】:metro-config node_modules not found in react-native project在 react-native 项目中找不到 metro-config node_modules
【发布时间】:2020-03-24 17:40:33
【问题描述】:
我在我的项目中提供“react-native start”命令,它给了我以下错误。
无效的正则表达式:/(.\__fixtures__\.|node_modules[\]react[\]dist[\].|website\node_modules\.|heapCapture \bundle.js|.\__tests__\.)$/:未终止字符类
I have found above problem solution here.
但问题是当我试图导航到 "node_modules\metro-config\src\defaults\blacklist.js" 这个路径时,没有名为 "metro-config" 的文件夹。
我确实删除了 node_modules 并重新安装它们,但问题仍然相同。
【问题讨论】:
标签:
android
node.js
reactjs
react-native
node-modules
【解决方案1】:
简单的解决方案->要找到metro-config去你的窗口搜索栏输入metro-config或直接输入blacklist.js,你会找到文件的确切位置
【解决方案2】:
您也可以在此位置找到blacklist.js 文件node_modules/metro/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__\/.*/
];
我昨晚才修好的。