weixin_39796533
2021-01-12 11:56 阅读 2

Not compatible with RN 0.60 autolinking

Bug

Environment info

React native info output:

bash
 // error React Native CLI uses autolinking for native dependencies, but the following modules are linked manually: 
  - react-native-device-info (to unlink run: "react-native unlink react-native-device-info")
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
</dependency>

Library version: 2.2.2

Steps To Reproduce

  1. Create an app using react-native init project
  2. Install the package ...

Describe what you expected to happen:

  1. The app should run without error

该提问来源于开源项目:react-native-device-info/react-native-device-info

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

12条回答 默认 最新

  • weixin_39943547 weixin_39943547 2021-01-12 11:56

    Same for me as well. I must use

    
    'react-native-device-info': {
            platforms: {
              ios: null
            }
          }
    

    in react-native.config.js to make it work on both ios and android. But still have the error

    
     // error React Native CLI uses autolinking for native dependencies, but the following modules are linked manually: 
      - react-native-device-info (to unlink run: "react-native unlink react-native-device-info")
    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
    </dependency>
    点赞 评论 复制链接分享
  • weixin_39617405 weixin_39617405 2021-01-12 11:56

    If you nulled android too that warning would likely go awsy

    点赞 评论 复制链接分享
  • weixin_39637921 weixin_39637921 2021-01-12 11:56

    got any solution ?

    点赞 评论 复制链接分享
  • weixin_39796533 weixin_39796533 2021-01-12 11:56

    waiting for a solution too

    点赞 评论 复制链接分享
  • weixin_39617405 weixin_39617405 2021-01-12 11:56

    The solution is in the comments here?

    点赞 评论 复制链接分享
  • weixin_39783360 weixin_39783360 2021-01-12 11:56

    are u able to run it on android

    点赞 评论 复制链接分享
  • weixin_39617405 weixin_39617405 2021-01-12 11:56

    I am running this fine on android, there is no auto-linking problem, the "error message" in this issue is not actually an error. It is a result of manually linking instead of just installing the package and letting it run

    点赞 评论 复制链接分享
  • weixin_39617405 weixin_39617405 2021-01-12 11:56

    I am updating the README to be specific about this

    点赞 评论 复制链接分享
  • weixin_39828956 weixin_39828956 2021-01-12 11:56

    you are right! I think it should be labeled as "warning" instead "error".

    点赞 评论 复制链接分享
  • weixin_39617405 weixin_39617405 2021-01-12 11:56

    open an issue with the react-native-community/cli repo if you like, it's from them

    点赞 评论 复制链接分享
  • weixin_39828956 weixin_39828956 2021-01-12 11:56

    Yes, I know it's from them. For this much small issue, I don't think it will be right to open an issue.

    点赞 评论 复制链接分享
  • weixin_39612297 weixin_39612297 2021-01-12 11:56

    Try to this solution. create react-native.config.js and add below lines.

    module.exports = { dependencies: { "react-native-device-info": { platforms: { android: null, ios: null } } }, };

    点赞 评论 复制链接分享

相关推荐