使用TypeORM的React-Native,babel转换错误“无法找到程序”

a64a0gku  于 2023-06-20  发布在  Babel
关注(0)|答案(1)|浏览(224)

我是React-Native library的维护者。当我尝试将我的包升级到最新版本的React-Native时,我开始收到一个babel transform错误:

下面是堆栈的转录:

LOG  Running "QuickSQLiteExample" with {"rootTag":1,"initialProps":{}}
error: node_modules/typeorm/browser/schema-builder/RdbmsSchemaBuilder.js: /Users/osp/Developer/react-native-quick-sqlite/example/node_modules/typeorm/browser/schema-builder/RdbmsSchemaBuilder.js: Couldn't find a Program
 ERROR  [Error: TransformError node_modules/typeorm/browser/schema-builder/RdbmsSchemaBuilder.js: /Users/osp/Developer/react-native-quick-sqlite/example/node_modules/typeorm/browser/schema-builder/RdbmsSchemaBuilder.js: Couldn't find a Program]
Error: /Users/osp/Developer/react-native-quick-sqlite/example/node_modules/typeorm/browser/schema-builder/RdbmsSchemaBuilder.js: Couldn't find a Program
    at Scope.getProgramParent (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@babel/core/node_modules/@babel/traverse/lib/scope/index.js:768:11)
    at Scope.crawl (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@babel/core/node_modules/@babel/traverse/lib/scope/index.js:686:32)
    at Scope.init (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@babel/core/node_modules/@babel/traverse/lib/scope/index.js:676:12)
    at NodePath.setScope (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:122:30)
    at NodePath.setContext (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:134:8)
    at NodePath.popContext (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:192:10)
    at TraversalContext.visitQueue (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:109:12)
    at TraversalContext.visitMultiple (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:67:17)
    at TraversalContext.visit (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:119:19)
    at traverseNode (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@babel/core/node_modules/@babel/traverse/lib/traverse-node.js:18:17)
    at traverse (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@babel/core/node_modules/@babel/traverse/lib/index.js:50:34)
    at Function.traverse.hasType (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@babel/core/node_modules/@babel/traverse/lib/index.js:86:3)
    at BlockScoping.wrapClosure (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@babel/plugin-transform-block-scoping/lib/index.js:469:37)
    at BlockScoping.run (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@babel/plugin-transform-block-scoping/lib/index.js:335:12)
    at PluginPass.Loop (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@babel/plugin-transform-block-scoping/lib/index.js:59:38)
    at newFn (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/visitors.js:159:21)
    at NodePath._call (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:46:20)
    at NodePath.call (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:36:17)
    at NodePath.visit (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:84:31)
    at TraversalContext.visitQueue (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:96:16)
    at TraversalContext.visitMultiple (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:67:17)
    at TraversalContext.visit (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:119:19)
    at traverseNode (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/traverse-node.js:18:17)
    at NodePath.visit (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:90:52)
    at TraversalContext.visitQueue (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:96:16)
    at TraversalContext.visitSingle (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:72:19)
    at TraversalContext.visit (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:121:19)
    at traverseNode (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/traverse-node.js:18:17)
    at NodePath.visit (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:90:52)
    at TraversalContext.visitQueue (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:96:16)
    at TraversalContext.visitMultiple (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:67:17)
    at TraversalContext.visit (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:119:19)
    at traverseNode (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/traverse-node.js:18:17)
    at NodePath.visit (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:90:52)
    at TraversalContext.visitQueue (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:96:16)
    at TraversalContext.visitSingle (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:72:19)
    at TraversalContext.visit (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:121:19)
    at traverseNode (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/traverse-node.js:18:17)
    at NodePath.visit (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:90:52)
    at TraversalContext.visitQueue (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:96:16)
    at TraversalContext.visitMultiple (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:67:17)
    at TraversalContext.visit (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:119:19)
    at traverseNode (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/traverse-node.js:18:17)
    at NodePath.visit (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:90:52)
    at TraversalContext.visitQueue (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:96:16)
    at TraversalContext.visitMultiple (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:67:17)
    at TraversalContext.visit (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/context.js:119:19)
    at traverseNode (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/traverse-node.js:18:17)
    at NodePath.visit (/Users/osp/Developer/react-native-quick-sqlite/example/node_modules/@react-native-community/cli-plugin-metro/node_modules/metro-react-native-babel-transformer/node_modules/@babel/core/node_modules/@babel/traverse/lib/path/context.js:90:52)

做了一些研究,我发现this issue似乎指向重复的babel版本,但我已经尝试去重复,什么也没有发生。
这是我在TypeORM repo上创建的related issue,但在这里交叉发布,因为我现在TypeORM维护人员被工作淹没了。
有什么变通的办法吗?

yvt65v4c

yvt65v4c1#

删除node_modules、package-lock.json、yarn-lock.json并重新安装包。

相关问题