RN: iOS工程pod install realm 失败(realm-sync-cocoa无法下载)

在react-native项目总添加 realm时,发现在iOS工程中无法下载realm-sync-cocoa,一直卡在:

Installing RealmJS (10.1.3)
 > Running prepare command
   $ /bin/bash -c  set -e ./scripts/xcode-download-realm.sh ./scripts
   Resolved requirements: {
     SYNC_SERVER_FOLDER: 'sync',
     SYNC_ARCHIVE: 'realm-sync-cocoa-10.1.6.tar.gz',
     SYNC_ARCHIVE_ROOT: 'core'
   }
   Resolved options: { platform: 'ios', sync: true }
   No lockfile found at the target /Users/yif/Desktop/family-robot-one-desktop/node_modules/realm/vendor/realm-ios, proceeding.
   Download url: https://static.realm.io/downloads/sync/realm-sync-cocoa-10.1.6.tar.gz

最终使用该方式解决:https://www.jianshu.com/p/0ea2903d8b00

  1. 先把压缩包下载下来,具体路径查看控制台输出的Download url,然后修改node_modules/realm/scripts/download-realm.js 的download函数,将其修改成:
if (copyLocal(archive, destination)) {
        return Promise.resolve();
    }

    const url = `https://static.realm.io/downloads/${serverFolder}/${archive}`;
    console.log(`Download url: ${url}`);
    console.log(`destination path: ${destination}`);
    return new Promise(resole => {
        setTimeout(()=>{
            console.log('Time finished');
            resole();
        }, 120 * 1000);
    });
  1. 在控制台继续通过pod安装realm,控制台会输出缓存路径:destination path: /var/folders/8k/1q1ryw2d3vb4970w99zqpjtw0000gn/T/0421c79b252416274f2b94054db89f4aa3940f35/realm-sync-cocoa-10.1.6.tar.gz

3.将你预先下载的压缩包直接放入该文件目录中

4.等待修改函数的计数器执行完毕即可。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值