当前位置: 首页 > 知识库问答 >
问题:

ios - react-native unlink react-native-doc-viewer时,报了error: unknown command 'unlink'?

卢英叡
2023-06-02

我在项目的根目录执行
yarn ios --simulator 'iPhone 14 Pro'命令时,报了如下的错误:

React Native CLI uses autolinking for native dependencies, but the following modules are linked manually:
  • react-native-doc-viewer (to unlink run: "react-native unlink react-native-doc-viewer")
  • react-native-document-picker (to unlink run: "react-native unlink react-native-document-picker")
  • react-native-fs (to unlink run: "react-native unlink react-native-fs")

This is likely happening when upgrading React Native from below 0.60 to 0.60 or above. Going forward, you can unlink this dependency via "react-native unlink <dependency>" and it will be included in your app automatically. If a library isn't compatible with autolinking, disregard this message and notify the library maintainers.
但是当我按照提示去执行:
react-native unlink react-native-doc-viewer命令时,报了
error: unknown command 'unlink',请问有哪位大神,遇到了,亟待解决,求帮助?
如果提供的思路能够解决问题,会给予一个红包作为回报。

共有1个答案

司寇羽
2023-06-02

已经找到解决办法。
1、在项目的根目录下新建一个 react-native.config.js文件。
文件中如下配置:

// react-native.config.js
module.exports = {
  dependencies: {
    'react-native-doc-viewer': {
      platforms: {
        android: null,
        ios: null,
        // add more platform to disable auto-linking for them too
      },
    },
    'react-native-document-picker': {
      platforms: {
        android: null,
        ios: null,
        // add more platform to disable auto-linking for them too
      },
    },
    'react-native-fs': {
      platforms: {
        android: null,
        ios: null,
        // add more platform to disable auto-linking for them too
      },
    },
  }
}
 类似资料:
  • 当我试图在ios模拟器上运行应用程序时,我得到了这个。有谁能告诉我这个问题的原因/解决办法是什么。 以下构建命令失败:CompileC/users/xxx/library/developer/xcode/deriveddata/eattog-dfbqbeyhmbgzhfcodvhcaqjxepf/build/intermediates.noindex/p s.llvm.clang.1_0.comp

  • React PDF viewer 是用于查看 PDF 文档的 React 组件,采用 TypeScript 编写,完全基于 React hooks。 特性 支持密码保护的文档 缩放:支持自定义级别,例如实际大小、页面适合度和页面宽度 支持页面间导航 支持快速跳转到第一页和最后一页 搜索文本 预览页面缩略图 查看和导航目录 罗列和下载附件 支持文本选择和手动工具模式 支持不同的滚动模式 支持全屏模式

  • 命令失败:/usr/libexec/plistbuddy-c print:cfbundleidentifier build/build/products/debug-iphonesimulator/reactdemonavigation.app/info.plist print:条目“:cfbundleidentifier”不存在

  • 我在iOS中有一个相当复杂的React原生项目,我想把它移植到Android上,测试它的可移植性。我已经完成了以下标准安装说明: '安装最新的JDK安装Android SDK:On Mac:brew安装Android SDK导出Android_HOME=/usr/local/opt/Android SDK打开Android SDK管理器(在Mac上启动新的shell并运行Android);在出现的

  • 本文向大家介绍IOS React Native FlexBox详解及实例,包括了IOS React Native FlexBox详解及实例的使用技巧和注意事项,需要的朋友参考一下 IOS React Native FlexBox详解及资料整理, # 前言 学习本系列内容需要具备一定 HTML 开发基础,没有基础的朋友可以先转至 HTML 学习 本人接触 React Native 时间并不是特别长,

  • 我正在使用一个React原生应用程序,我正在尝试设置一个自定义的启动屏幕,但我不能。 React Native在默认情况下创建了一个LaunchScreen.xib,因此我在Images.xcAssets中创建了一个LaunchImage: 我还读到我必须修改选项中“应用图标和启动图像”下的“启动屏幕文件”: 如果有人能帮我解决那些麻烦,我将不胜感激。 提前道谢。