加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

reactjs – React Native:Podfiles导致名称共谋

发布时间:2020-12-15 20:20:17 所属栏目:百科 来源:网络整理
导读:我收到一个错误: Ambiguous resolution: module “…/myModule.js” tries to require ‘react-native’,but there are several files providing this module. You can delete or fix them: …/MyProject/ios/Pods/React/package.json …/MyProject/node_mo
我收到一个错误:

Ambiguous resolution: module “…/myModule.js” tries to require
‘react-native’,but there are several files providing this module. You
can delete or fix them:

…/MyProject/ios/Pods/React/package.json

…/MyProject/node_modules/react-native/package.json

我几乎可以肯定这是因为使用Podfiles,特别是当他们安装“React”文件夹时.但是,我不得不使用Podfiles来安装react-native-firebase.话虽如此,当我删除我的Pods文件夹下的React文件夹(ios / Pods / React)时,我再也无法使用react-native-firebase.

GitHub周围有一个修复程序,建议在Podfile中附加:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == "React"
      target.remove_from_project
    end
  end
end

但这对我不起作用.以前有人遇到过这个问题吗?

如果它是相关的,这是我正在使用的podfile:

platform :ios,'8.0'

target 'MyProject2' do
    pod 'Firebase/Core'
    pod 'Firebase/Database'
    pod 'Firebase/Messaging'

  pod 'RNSVG',:path => '../node_modules/react-native-svg'

  target 'MyProject2Tests' do
    inherit! :search_paths
    # Pods for testing
  end

  post_install do |installer|
    installer.pods_project.targets.each do |target|
      if target.name == "React"
        target.remove_from_project
      end
    end
  end

end

编辑:当我从我的Podfile中删除’RNSVG’时,我收到一条错误消息:“不变违规:’RNSVGPath’的原生组件不存在”.我已经运行了react-native链接,并按照反复本机svg的手动安装说明进行操作.

解决方法

我不得不手动将React pod连接到node_modules:

pod’React’,:path => ‘../node_modules/react-native’

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读