#独家
react-native unlink react-native-doc-viewer时,报了error: unknown command ‘unlink’?

2023-06-02 0 4,006

我在项目的根目录执行
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、在项目的根目录下新建一个 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
      },
    },
  }
}
收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

1. JK下载官网所有资源来源于开发团队,加入会员即可下载使用!如有问题请联系右下角在线客服!
2. JK下载官方保障所有软件都通过人工亲测,为每位会员用户提供安全可靠的应用软件、游戏资源下载及程序开发服务。
3. JK开发团队针对会员诉求,历经多年拥有现今开发成果, 每款应用程序上线前都经过人工测试无误后提供安装使用,只为会员提供安全原创的应用。
4. PC/移动端应用下载后如遇安装使用问题请联系右下角在线客服或提交工单,一对一指导解决疑难。

JK软件下载官网 技术分享 react-native unlink react-native-doc-viewer时,报了error: unknown command ‘unlink’? https://www.jkxiazai.com/1772.html

JK软件应用商店是经过官方安全认证,保障正版软件平台

相关资源

官方客服团队

为您解决烦忧 - 24小时在线 专业服务