Expo: Issue Sdk33 relating to expo-Constants

 ̄綄美尐妖づ 提交于 2019-12-11 10:52:42

问题


I have a message which I can't remove when running my application

The following APIs have moved to separate packages and importing them from the "expo" package is deprecated: Constants.

  1. Add correct versions of these packages to your project using:

    expo install expo-constants

    If "install" is not recognized as an expo command, update your expo-cli installation.

  2. Change your imports so they use specific packages instead of the "expo" package:

    • import { Constants } from 'expo' -> import Constants from 'expo-constants'

I have installed the "expo-constants": "^5.0.1" in my package.json

Inside the code already set as

import Constants from 'expo-constants'

Don't know why still having this message in my terminal when loading my application


回答1:


you must update expo with this command: npm install -g expo-cli then use this command : expo install expo-constants then Change your imports: import { Constants } from 'expo' -> import Constants from 'expo-constants'




回答2:


I also just updated to expo sdk33 and followed their directions to import Constants correctly, and I still also get the message. I believe this is not a sign that there's something wrong with your codebase but, instead, just a reminder they will have showing for a little while to make sure people see it and make the changes needed.




回答3:


There is also the possibility that a third-party module is still using the deprecated expo constants. As soon as you update to expo 34, you will know. That was happening to me. When this becomes a problem, just upgrade that module.




回答4:


Try this:

  1. delete node_modules folder
  2. delete package-lock.json file.
  3. npm install
  4. expo start -c


来源:https://stackoverflow.com/questions/56519374/expo-issue-sdk33-relating-to-expo-constants

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!