Android 类型脚本模块react导航上的react本机捆绑脚本引发语法错误
使用Android 类型脚本模块react导航上的react本机捆绑脚本引发语法错误,android,typescript,react-native,babeljs,react-native-navigation,Android,Typescript,React Native,Babeljs,React Native Navigation,使用react native bundle脚本运行生成时,在涉及typescript的react导航模块上引发错误 我正在运行以下脚本将资产构建到特定文件夹中: react native bundle--reset cache--platform android--dev false--entry file index.js--bundle output android/app/src/main/assets/index.android.bundle--assets dest android/a
react native bundle
脚本运行生成时,在涉及typescript的react导航模块上引发错误
我正在运行以下脚本将资产构建到特定文件夹中:
react native bundle--reset cache--platform android--dev false--entry file index.js--bundle output android/app/src/main/assets/index.android.bundle--assets dest android/app/src/main/res
下面的错误是
error SyntaxError: /Users/sachinkaria/Desktop/chemistri/qem-native-test-build/node_modules/@react-navigation/stack/src/index.tsx: Unexpected token (51:12)
49 | * Types
50 | */
> 51 | export type {
| ^
52 | StackNavigationOptions,
53 | StackNavigationProp,
54 | StackScreenProps,. Run CLI with --verbose flag for more details.
SyntaxError: /Users/sachinkaria/Desktop/chemistri/qem-native-test-build/node_modules/@react-navigation/stack/src/index.tsx: Unexpected token (51:12)
49 | * Types
50 | */
> 51 | export type {
| ^
52 | StackNavigationOptions,
53 | StackNavigationProp,
54 | StackScreenProps,
at Object.raise (/Users/sachinkaria/.config/yarn/global/node_modules/@babel/parser/lib/index.js:6400:17)
at Object.unexpected (/Users/sachinkaria/.config/yarn/global/node_modules/@babel/parser/lib/index.js:7728:16)
at Object.parseIdentifierName (/Users/sachinkaria/.config/yarn/global/node_modules/@babel/parser/lib/index.js:9624:18)
at Object.parseIdentifier (/Users/sachinkaria/.config/yarn/global/node_modules/@babel/parser/lib/index.js:9598:23)
at Object.tsParseTypeAliasDeclaration (/Users/sachinkaria/.config/yarn/global/node_modules/@babel/parser/lib/index.js:4793:20)
at Object.tsParseDeclaration (/Users/sachinkaria/.config/yarn/global/node_modules/@babel/parser/lib/index.js:5111:23)
at Object.tsTryParseExportDeclaration (/Users/sachinkaria/.config/yarn/global/node_modules/@babel/parser/lib/index.js:5020:17)
at Object.parseExportDeclaration (/Users/sachinkaria/.config/yarn/global/node_modules/@babel/parser/lib/index.js:5497:26)
at Object.maybeParseExportDeclaration (/Users/sachinkaria/.config/yarn/global/node_modules/@babel/parser/lib/index.js:11070:31)
at Object.parseExport (/Users/sachinkaria/.config/yarn/global/node_modules/@babel/parser/lib/index.js:10999:29)
My package.json如下所示:
{
"name": "Example",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint .",
"update:pods": "cd ios && pod install --repo-update && cd ..",
"postinstall": "yarn run update:pods"
},
"dependencies": {
"@expo/react-native-action-sheet": "^3.8.0",
"@notifee/react-native": "^0.9.1",
"@ptomasroos/react-native-multi-slider": "^2.2.2",
"@react-native-community/async-storage": "^1.11.0",
"@react-native-community/checkbox": "^0.4.2",
"@react-native-community/clipboard": "^1.2.3",
"@react-native-community/datetimepicker": "^2.6.1",
"@react-native-community/image-editor": "^2.3.0",
"@react-native-community/masked-view": "^0.1.10",
"@react-native-community/netinfo": "^5.9.5",
"@react-native-community/slider": "^3.0.3",
"@react-native-community/toolbar-android": "0.1.0-rc.2",
"@react-native-community/viewpager": "^4.1.3",
"@react-native-firebase/app": "^8.4.1",
"@react-native-firebase/auth": "^8.0.9",
"@react-native-firebase/firestore": "^7.2.3",
"@react-native-firebase/messaging": "^7.2.1",
"@react-native-firebase/remote-config": "^9.0.2",
"@react-native-firebase/storage": "^7.1.7",
"@react-navigation/bottom-tabs": "^5.6.1",
"@react-navigation/native": "^5.2.6",
"@react-navigation/stack": "^5.3.1",
"@storybook/react-native": "^5.3.19",
"add": "^2.0.6",
"apisauce": "^1.1.1",
"base-64": "^0.1.0",
"compare-versions": "^3.6.0",
"expo-asset": "^8.1.7",
"expo-av": "^8.2.1",
"expo-constants": "^9.1.1",
"expo-file-system": "^9.0.1",
"expo-font": "^8.2.1",
"expo-image-manipulator": "^8.2.1",
"expo-image-picker": "^8.3.0",
"expo-location": "^8.2.1",
"expo-permissions": "^9.0.1",
"formik": "^2.1.4",
"i": "^0.3.6",
"lodash": "^4.17.15",
"moment": "^2.27.0",
"native-base": "^2.13.12",
"ngeohash": "^0.6.3",
"npm": "^6.14.5",
"prop-types": "^15.7.2",
"react": "16.11.0",
"react-native": "0.62.2",
"react-native-animatable": "^1.3.3",
"react-native-calendars": "^1.300.0",
"react-native-datepicker": "^1.7.2",
"react-native-device-info": "^6.0.0",
"react-native-dotenv": "^0.2.0",
"react-native-easy-grid": "^0.2.2",
"react-native-fbsdk": "^2.0.0",
"react-native-geocoding": "^0.4.0",
"react-native-gesture-handler": "^1.6.1",
"react-native-gifted-chat": "^0.16.3",
"react-native-keyboard-aware-scroll-view": "^0.9.1",
"react-native-maps": "^0.27.1",
"react-native-mixpanel": "^1.2.0",
"react-native-modal": "^11.5.6",
"react-native-permissions": "^2.1.5",
"react-native-reanimated": "^1.9.0",
"react-native-safe-area-context": "^0.7.3",
"react-native-screens": "^2.9.0",
"react-native-snap-carousel": "^3.9.1",
"react-native-splash-screen": "^3.2.0",
"react-native-svg": "^12.1.0",
"react-native-swiper": "^1.6.0",
"react-native-unimodules": "^0.10.1",
"react-native-vector-icons": "^6.6.0",
"react-native-view-overflow": "^0.0.5",
"yup": "^0.29.1"
},
"devDependencies": {
"@babel/core": "7.9.6",
"@babel/runtime": "7.9.6",
"@react-native-community/eslint-config": "^0.0.5",
"babel-jest": "^24.9.0",
"eslint": "^6.8.0",
"jest": "^24.9.0",
"metro-react-native-babel-preset": "^0.58.0",
"react-test-renderer": "16.11.0"
},
"jest": {
"preset": "react-native"
}
}
我尝试了以下方法:
- 移除
和纱线.锁
节点模块
- 使用
纱线缓存清理清理缓存
- 用安卓cd进行梯度清理。/梯度清理
- 重新安装模块
react native bundle--reset cache--platform android--dev false--entry file index.js--bundle output android/app/src/main/assets/index.android.bundle--assets dest android/app/src/main/res
npm更新
我也有同样的错误。
我认为你有依赖问题
尝试:npm更新