问题
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.
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.
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:
- delete node_modules folder
- delete package-lock.json file.
- npm install
- expo start -c
来源:https://stackoverflow.com/questions/56519374/expo-issue-sdk33-relating-to-expo-constants