将expo
从SDK 26升级到SDK 32后,当我使用expo run emulator
或expo app
时遇到以下问题:
/用户/名称用户/项目名称/node_modules/expo/AppEntry.js:无法读取未定义的属性“ 1”
AppEntry.js:
import { KeepAwake, registerRootComponent } from 'expo';
import App from '../../App';
if (__DEV__) {
KeepAwake.activate();
}
registerRootComponent(App);
package.json:
{
“main”: “node_modules/expo/AppEntry.js”,
“private”: true,
“scripts”: {
“test”: “node ./node_modules/jest/bin/jest.js --watchAll”
},
“jest”: {
“preset”: “jest-expo”
},
“dependencies”: {
“@expo/samples”: “2.1.1”,
“babel-preset-expo”: “^5.1.1”,
“expo”: “^32.0.0”,
“npm”: “^4.6.1”,
“react”: “16.5.0”,
“react-native”: “https://github.com/expo/react-
native/archive/sdk- 32.0.0.tar.gz”,
“react-native-animatable”: “^1.2.4”,
“react-native-device-info”: “^0.21.5”,
“react-native-drawer”: “^2.5.0”,
“react-native-drawer-menu”: “^0.2.5”,
“react-native-elements”: “^0.19.1”,
“react-native-fetch-polyfill”: “^1.1.2”,
“react-native-geocoder”: “^0.5.0”,
“react-native-geocoding”: “^0.3.0”,
“react-native-google-maps-directions”: “^2.0.0”,
“react-native-keyboard-spacer”: “^0.4.1”,
“react-native-maps”: “^0.21.0”,
“react-native-masked-text”: “^1.6.5”,
“react-native-qrcode-svg”: “^5.1.1”,
“react-native-select-input-ios”: “^1.2.0”,
“react-native-swipeable”: “^0.6.0”,
“react-native-swiper”: “^1.5.13”,
“react-native-touch-id”: “^4.0.4”,
“react-native-vector-icons”: “^4.6.0”,
“react-navigation”: “^3.0.9”
},
“devDependencies”: {
“@babel/core”: “^7.4.3”,
“@babel/preset-env”: “^7.0.0-beta.47”,
“gulp-babel”: “^7.0.1”,
“jest-expo”: “^32.0.0”
}
}
编辑: After adjusting at the suggestion, I'm getting this error:
用户/用户名/项目名称/App.js:无法读取未定义的属性“文件名”
是否有尝试解决方案的想法?任何帮助将不胜感激!
答案 0 :(得分:0)
查看expo
的问题日志,我发现其他人在从以下位置进行更新时也遇到了类似的问题:
SDK版本30到SDK版本31
,此问题与其babel
的配置有关。也许您正在处理同一问题,也许您可以尝试他们的suggested解决方案,并查看自从SDK版本26更新以来是否也解决了您的问题。
这是他们的建议:
安装babel-plugin-module-resolver
的最新版本:
npm i --save-dev babel-plugin-module-resolver@latest
或者:
yarn add babel-plugin-module-resolver@latest
另外,其他人必须更改其.babelrc
的内容才能使用"babel-preset-expo"
预设:
.babelrc
{
"presets": ["babel-preset-expo"]
}
希望有帮助!