gpt4 book ai didi

javascript - 为什么 Pod 依赖管理器没有检测到安装所需的模块?

转载 作者:行者123 更新时间:2023-12-03 14:30:17 25 4
gpt4 key购买 nike

So this question is a follow up to my previous question:How can different apps import from a shared components folder? react / react-native

因此,我创建了自己的 npm 模块,将所有组件存储在其中。这些组件可供我喜欢的任意数量的应用程序使用。因为我将使这些组件高度可重用。

但是我仍然偶然发现了一个问题。

我创建了一个使用此库的加载组件:@react-native-community/masked-view。该库需要在/ios/Podfile 中安装依赖项。 首先我在一个react-native项目中创建了这个组件。

yarn add @react-native-community/masked-view
..
success Saved 1 new dependency.

cd ios/
pod install
..
Installing RNCMaskedView (0.1.6)
Pod installation complete! There are 33 dependencies from the Podfile and 31 total pods installed.

'

然后我运行了我的代码,加载组件工作了。现在我想将其添加到 NPM 模块(同样是我自己创建的),该模块将包含我的所有组件。

所以我进入/my-awesome-99-components/,它有自己的 package.json ,因为它是一个我将在我正在处理的每个项目中导入的模块。

在/my-awesome-99-components/

yarn add react react-native @react-native-community/masked-view
..
success Saved 1 new dependency.

// Created Loading.js - this is the loading component

yarn publish
..

在/react-native-project-1/

yarn add my-awesome-99-components
..
Done in 3.17s.

cd ios/
Pod install
..

This is where the problem comes up. Now the Podfile won't install the RNCMaskedView because apparently my module doesn't let the project know that it should install some packages inside the ios/Podfile.

Does anyone know why this happens, and what would be the best solution for this?

感谢所有的帮助!

最佳答案

您是否尝试过将 podspec 文件添加到您的存储库中?

您可以从 masked-view 包中修改 podspec 文件,例如

require 'json'

package = JSON.parse(File.read(File.join(__dir__, 'package.json')))

Pod::Spec.new do |s|
s.name = "RNCMaskedView"
s.version = package['version']
s.summary = package['description']

s.authors = package['author']
s.platforms = { :ios => "9.0", :tvos => "9.0" }

s.source = { :git => "https://github.com/react-native-community/react-native-masked-view.git", :tag => "v#{s.version}" }
s.source_files = "node_modules/@react-native-community/masked-view/ios/**/*.{h,m}"

s.dependency 'React'
end

这里唯一改变的是源文件的路径

关于javascript - 为什么 Pod 依赖管理器没有检测到安装所需的模块?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59724998/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com