我将react-native从0.48.4升级到0.51.0之后我得到了这个错误。每当我运行packager.Here是控制台输出
bundling failed: TypeError: /node_modules/react-native/Libraries/Animated/src/createAnimatedComponent.js: Duplicate declaration "AnimatedComponent" (This is an error on an internal node. Probably an internal error)
at File.buildCodeFrameError (/node_modules/babel-core/lib/transformation/file/index.js:427:15)
at Scope.checkBlockScopedCollisions (/node_modules/babel-core/node_modules/babel-traverse/lib/scope/index.js:398:27)
at Scope.registerBinding (/node_modules/babel-core/node_modules/babel-traverse/lib/scope/index.js:592:16)
at Scope.registerDeclaration (node_modules/babel-core/node_modules/babel-traverse/lib/scope/index.js:496:14)
at Object.BlockScoped (node_modules/babel-core/node_modules/babel-traverse/lib/scope/index.js:244:28)
at Object.newFn (node_modules/babel-core/node_modules/babel-traverse/lib/visitors.js:318:17)
at NodePath._call (node_modules/babel-core/node_modules/babel-traverse/lib/path/context.js:76:18)
at NodePath.call (/node_modules/babel-core/node_modules/babel-traverse/lib/path/context.js:44:14)
at NodePath.visit (/node_modules/babel-core/node_modules/babel-traverse/lib/path/context.js:105:12)
信息:当我工作时react-native 48.4如果我启用Hot模块重新加载(hmr)我曾经得到这个错误。更新到51.0之后由于捆绑错误我无法开发服务器
答案 0 :(得分:2)
可能问题在于transform-react-remove-prop-types
babel插件。
尝试从.babelrc
删除此插件,它将解决问题。