尝试更新到 Expo SDK 34。遇到未定义的错误不是对象(正在评估“_expo.constants.manifest”)
Trying to update to Expo SDK 34. Hitting an error of undefined is not an object (evaluating '_expo.constants.manifest')
我正在执行将 expo 更新到最新版本 (34.0.0) 的步骤,但我遇到了一个问题,每当我尝试加载我的模拟器时,它都会出错 "undefined is not an object (evaluating '_expo.Constants.manifest')".我已经关注了 expo 文档,并且知道更新可能会出现一些问题,但我找不到与此问题具体相关的任何内容。
我的 package.json 看起来像这样:
{
"name": "empty-project-template",
"main": "node_modules/expo/AppEntry.js",
"private": true,
"scripts": {
"storybook": "CONFIG_IS_STORYBOOK=true node startWithEnv.js",
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"eject": "expo eject"
},
"dependencies": {
"axios": "^0.18.1",
"expo": "^34.0.4",
"expo-constants": "~6.0.0",
"formik": "^1.3.2",
"hoist-non-react-statics": "^3.2.1",
"react": "16.8.3",
"react-native": "https://github.com/expo/react-native/archive/sdk-34.0.0.tar.gz",
"react-native-easy-grid": "^0.2.0",
"react-native-elements": "^0.19.1",
"react-native-gesture-handler": "~1.3.0",
"react-native-safe-area-view": "^0.11.0",
"react-native-touchable-scale": "^2.0.0",
"react-navigation": "^3.11.1",
"styled-components": "^4.1.1",
"unstated": "^2.1.1",
"xml-query": "^1.5.0",
"xml-reader": "^2.4.3"
},
"devDependencies": {
"@storybook/react-native": "^4.0.7",
"babel-preset-expo": "^5.0.0",
"chalk": "^2.4.1",
"figlet": "^1.2.1",
"shelljs": "^0.8.3",
"yargs": "^12.0.2"
}
}
我的 app.json 看起来像这样:
{
"expo": {
"name": "Project Name",
"description": "This project is really great.",
"slug": "ProjectName-ios",
"privacy": "public",
"sdkVersion": "34.0.0",
"platforms": ["ios", "android"],
"version": "0.1.4",
"orientation": "portrait",
"icon": "./assets/AppIcon@1x.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": ["**/*"],
"ios": {
"supportsTablet": true,
"bundleIdentifier": "it.project.project",
"config": {
"usesNonExemptEncryption": false
},
"infoPlist": {
"NSCameraUsageDescription": "Fill this in"
}
},
"android": {
"package": "it.project.project"
}
}
}
您需要 运行 expo 安装 expo-constants。
将应用程序源代码的导入更改为
import Constants from 'expo-constants';
我正在执行将 expo 更新到最新版本 (34.0.0) 的步骤,但我遇到了一个问题,每当我尝试加载我的模拟器时,它都会出错 "undefined is not an object (evaluating '_expo.Constants.manifest')".我已经关注了 expo 文档,并且知道更新可能会出现一些问题,但我找不到与此问题具体相关的任何内容。
我的 package.json 看起来像这样:
{
"name": "empty-project-template",
"main": "node_modules/expo/AppEntry.js",
"private": true,
"scripts": {
"storybook": "CONFIG_IS_STORYBOOK=true node startWithEnv.js",
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"eject": "expo eject"
},
"dependencies": {
"axios": "^0.18.1",
"expo": "^34.0.4",
"expo-constants": "~6.0.0",
"formik": "^1.3.2",
"hoist-non-react-statics": "^3.2.1",
"react": "16.8.3",
"react-native": "https://github.com/expo/react-native/archive/sdk-34.0.0.tar.gz",
"react-native-easy-grid": "^0.2.0",
"react-native-elements": "^0.19.1",
"react-native-gesture-handler": "~1.3.0",
"react-native-safe-area-view": "^0.11.0",
"react-native-touchable-scale": "^2.0.0",
"react-navigation": "^3.11.1",
"styled-components": "^4.1.1",
"unstated": "^2.1.1",
"xml-query": "^1.5.0",
"xml-reader": "^2.4.3"
},
"devDependencies": {
"@storybook/react-native": "^4.0.7",
"babel-preset-expo": "^5.0.0",
"chalk": "^2.4.1",
"figlet": "^1.2.1",
"shelljs": "^0.8.3",
"yargs": "^12.0.2"
}
}
我的 app.json 看起来像这样:
{
"expo": {
"name": "Project Name",
"description": "This project is really great.",
"slug": "ProjectName-ios",
"privacy": "public",
"sdkVersion": "34.0.0",
"platforms": ["ios", "android"],
"version": "0.1.4",
"orientation": "portrait",
"icon": "./assets/AppIcon@1x.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": ["**/*"],
"ios": {
"supportsTablet": true,
"bundleIdentifier": "it.project.project",
"config": {
"usesNonExemptEncryption": false
},
"infoPlist": {
"NSCameraUsageDescription": "Fill this in"
}
},
"android": {
"package": "it.project.project"
}
}
}
您需要 运行 expo 安装 expo-constants。 将应用程序源代码的导入更改为
import Constants from 'expo-constants';