You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

运行npx react-native init testApp遇nkf安装错误,如何解决?

解决npx react-native init testApp中nkf安装失败的问题

问题说明

执行npx react-native init testApp时,出现Bundler无法安装nkf(0.2.0)的错误,导致Ruby Gems安装失败,iOS端Pods无法自动完成安装。

解决步骤

  • 进入项目的iOS目录:

    cd testApp/ios
    
  • 方法一:指定CFPropertyList版本绕过nkf依赖问题
    旧版CFPropertyList(3.0.7)依赖的nkf(0.2.0)存在安装兼容问题,降级到3.0.6版本即可解决:

    1. 编辑当前目录下的Gemfile,添加或修改以下内容:
      gem 'CFPropertyList', '~> 3.0.6'
      
    2. 重新安装Ruby依赖:
      bundle install
      
    3. 手动安装Pods:
      pod install
      
  • 方法二:升级Ruby版本
    部分旧Ruby版本与nkf(0.2.0)不兼容,升级到Ruby 3.0及以上版本可解决:

    1. 若使用rbenv管理Ruby版本,执行:
      rbenv install 3.2.2
      rbenv local 3.2.2
      
    2. 重新安装依赖并安装Pods:
      bundle install
      pod install
      
  • 方法三:强制更新所有Ruby依赖
    直接更新所有Gem依赖,让Bundler自动选择兼容的版本:

    bundle update
    pod install
    

内容的提问来源于stack exchange,提问作者iSaBo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.28 15:22:42