gpt4 book ai didi

reactjs - react native 错误 : bundling failed: SyntaxError: React native projects\appOne\node_modules\@react-navigation\routers\src\index. tsx

转载 作者:行者123 更新时间:2023-12-05 02:53:18 25 4
gpt4 key购买 nike

我负责这个项目。 npx react-native run-android为什么会出现这个错误?我需要指导来解决这个问题。

Error Image

Looking for JS files in
D:\React native projects\appOne

Loading dependency graph, done.
error: bundling failed: SyntaxError: D:\React native projects\appOne\node_modules\@react-navigation\routers\src\index.tsx: Unexpected token (9:12)

7 | export { default as StackRouter, StackActions } from './StackRouter';
8 |
> 9 | export type {
| ^
10 | StackActionHelpers,
11 | StackActionType,
12 | StackRouterOptions,
at Object.raise (D:\React native projects\appOne\node_modules\@babel\core\node_modules\@babel\parser\lib\index.js:6387:17)
at Object.unexpected (D:\React native projects\appOne\node_modules\@babel\core\node_modules\@babel\parser\lib\index.js:7704:16)
at Object.parseIdentifierName (D:\React native projects\appOne\node_modules\@babel\core\node_modules\@babel\parser\lib\index.js:9592:18)
at Object.parseIdentifier (D:\React native projects\appOne\node_modules\@babel\core\node_modules\@babel\parser\lib\index.js:9570:23)
at Object.tsParseTypeAliasDeclaration (D:\React native projects\appOne\node_modules\@babel\core\node_modules\@babel\parser\lib\index.js:4793:20)
at Object.tsParseDeclaration (D:\React native projects\appOne\node_modules\@babel\core\node_modules\@babel\parser\lib\index.js:5111:23)
at Object.tsTryParseExportDeclaration (D:\React native projects\appOne\node_modules\@babel\core\node_modules\@babel\parser\lib\index.js:5020:17)
at Object.parseExportDeclaration (D:\React native projects\appOne\node_modules\@babel\core\node_modules\@babel\parser\lib\index.js:5497:26)
at Object.maybeParseExportDeclaration (D:\React native projects\appOne\node_modules\@babel\core\node_modules\@babel\parser\lib\index.js:11038:31)
at Object.parseExport (D:\React native projects\appOne\node_modules\@babel\core\node_modules\@babel\parser\lib\index.js:10967:29)
BUNDLE [android, dev] ./index.js ▓▓▓▓░░░░░░░░░░░░ 30.9% (266/496), failed.

::ffff:127.0.0.1 - - [08/Jun/2020:19:52:38 +0000] "GET /index.bundle?platform=android&dev=true&minify=false HTTP/1.1" 500 - "-" "okhttp/3.12.1"

最佳答案

type-only importsexportsTypeScript 3.8 中的新功能。 Babel 通过此 merge request 添加了对仅类型导入/导出的支持从版本 7.9.0

开始可用

如下所示更新您的 babel 版本:

 "devDependencies": {
"@babel/core": "^7.9.0",
"@babel/runtime": "^7.9.2",
//other dev dependencies
}

您可能需要删除 node_modules,重新安装并清除缓存。

关于reactjs - react native 错误 : bundling failed: SyntaxError: React native projects\appOne\node_modules\@react-navigation\routers\src\index. tsx,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62270438/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com