将expo
从SDK 26升级到SDK 32后,当我使用expo run emulator
或expo app
时出现以下问题:
/ Users / name user / project name / 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:无法读取未定义的属性'filename'
有关潜在解决方案的任何想法尝试?任何帮助将不胜感激!
查看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"]
}
希望这有帮助!