error: bundling failed: NotFoundError: Cannot find entry file index.ios.js in any of the roots:

RN运行时android调试正常,在ios运行时终端报错,Build编译是正常的

  error: bundling failed: NotFoundError: Cannot find entry file index.ios.js in any of the roots: ["/Users/hld/Desktop/project/RN/ZRApp"]
        at DependencyGraph.getAbsolutePath (/Users/hld/Desktop/project/RN/ZRApp/node_modules/metro/src/node-haste/DependencyGraph.js:317:11)
        at /Users/hld/Desktop/project/RN/ZRApp/node_modules/metro/src/DeltaBundler/DeltaCalculator.js:280:416
        at Generator.next (<anonymous>)
        at step (/Users/hld/Desktop/project/RN/ZRApp/node_modules/metro/src/DeltaBundler/DeltaCalculator.js:11:445)
        at /Users/hld/Desktop/project/RN/ZRApp/node_modules/metro/src/DeltaBundler/DeltaCalculator.js:11:605
        at process._tickCallback (internal/process/next_tick.js:68:7)

Build编译通过,运行失败,终端以上报错,原因是找不到index.ios

解决方法: 原来在集成官方Pushy热更新的时候,复制了开发文档中的配置Bundle URL代码,

#ifdef DEBUG
  //开发包
  jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@“index.ios" fallbackResource:nil];//错误原因
#else
  //离线包
//  jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"bundle/index.ios" withExtension:@"jsbundle"];
  jsCodeLocation=[RCTHotUpdate bundleURL];
#endif

在debug时,jsCodeLocation运行index.ios,实际上RN0.44以后是不区分android与ios.js,只需要修改
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@“index" fallbackResource:nil];这一行代码就可以重新编译就解决了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值