React-native run-android命令通过在android模拟器中留下消息来终止。信息如下:
无法加载脚本。确保你要么运行Metro服务器,要么运行你的捆绑包index.android。Bundle '被正确地打包以便发布。
我做错了什么?
React-native run-android命令通过在android模拟器中留下消息来终止。信息如下:
无法加载脚本。确保你要么运行Metro服务器,要么运行你的捆绑包index.android。Bundle '被正确地打包以便发布。
我做错了什么?
当前回答
在尝试了几种方法后,这对我来说很有效。
在文件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__\/.*/
];
希望这能有所帮助。
其他回答
我做了: react-native开始 而且 NPX react-native run-android。
然而,对于Min19,(基于Ubuntu的)我也有同样的问题,直到我运行:
echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
来自: https://reactnative.dev/docs/troubleshooting#content
至少我手机里还有软件在运行。
在数小时寻找答案之后。解决方案是将节点降级到版本12.4。
在我的例子中,我意识到这个错误只发生在节点版本12.6的react native 0.60版本中。
如果你已经尝试了上述解决方案中的所有方法,可以尝试以下步骤:
在android/app/src/main/assets中创建文件 执行如下命令:
React-native bundle——platform android——dev false——entry-file index.js——bundle-output android/app/src/main/assets/index.android。Bundle——assets-dest android/app/src/main/res
现在运行命令构建react-native run-android
在尝试了几种方法后,这对我来说很有效。
在文件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__\/.*/
];
希望这能有所帮助。
我得到了同样的问题,在遵循以下步骤后,它得到了解决的问题
清晰的守望人守望:守望人守望一切。 删除“node_modules”文件夹:rm -rf node_modules && npm install。 Reset Metro Bundler cache: rm -rf /tmp/ Metro - Bundler -cache-* 删除急速缓存:rm -rf /tmp/急速-map-react-native-packager-*