【发布时间】:2019-03-06 05:25:43
【问题描述】:
我在运行 react-native 应用程序时也面临同样的问题。我使用的版本如下:
反应原生:0.57.1 反应原生 cli:2.0.1 节点:v8.11.3 npm:5.6.0
Babel 版本详情:
"devDependencies": { "@babel/runtime": "^7.0.0", "babel-jest": "20.0.3", "babel-preset-react-native": "^2.1.0" , "jest": "20.0.4", "react-test-renderer": "16.0.0-alpha.12", "schedule": "^0.4.0" }, "jest": { "preset": “反应原生” } }
错误:
错误:捆绑失败:TypeError:无法读取属性“绑定”的 空值 在 Scope.moveBindingTo (/home/manish/Desktop/Practice/donut/node_modules/@babel/traverse/lib/scope/index.js:867:13) 在 BlockScoping.updateScopeInfo (/home/manish/Desktop/Practice/donut/node_modules/babel-plugin-transform-es2015-block-scoping/lib/index.js:364:17) 在 BlockScoping.run (/home/manish/Desktop/Practice/donut/node_modules/babel-plugin-transform-es2015-block-scoping/lib/index.js:330:12) 在 PluginPass.BlockStatementSwitchStatementProgram (/home/manish/Desktop/Practice/donut/node_modules/babel-plugin-transform-es2015-block-scoping/lib/index.js:70:24) 在 newFn (/home/manish/Desktop/Practice/donut/node_modules/@babel/traverse/lib/visitors.js:193:21) 在 NodePath._call (/home/manish/Desktop/Practice/donut/node_modules/@babel/traverse/lib/path/context.js:53:20) 在 NodePath.call (/home/manish/Desktop/Practice/donut/node_modules/@babel/traverse/lib/path/context.js:40:17) 在 NodePath.visit (/home/manish/Desktop/Practice/donut/node_modules/@babel/traverse/lib/path/context.js:88:12) 在 TraversalContext.visitQueue (/home/manish/Desktop/Practice/donut/node_modules/@babel/traverse/lib/context.js:118:16) 捆绑 [android, dev] ./index.android.js ░░░░░░░░░░░░░░░░ 0.0% (0/3)::ffff:127.0.0.1 - - [01/Oct/2018:05:31:17 +0000] "获取 /index.android.delta?platform=android&dev=true&minify=false HTTP/1.1" 500 - “-” “okhttp/3.10.0” 捆绑包 [android, dev] ./index.android.js ░░░░░░░░░░░░░░░░ 0.0% (0/3),失败。
似乎错误是由于 babel 来的。但无法得到解决方案。这个问题的解决方案是什么?
【问题讨论】:
-
到目前为止你尝试了什么?
-
我刚刚从存储库中克隆了我的项目并尝试运行它,但它显示错误。进行一些更改后,我仍然收到此错误。
-
什么是 Babel 版本?这与 typescript 和 reactnative 版本兼容吗?
-
"devDependencies": { "@babel/runtime": "^7.0.0", "babel-jest": "20.0.3", "babel-preset-react-native": " ^2.1.0”、“jest”:“20.0.4”、“react-test-renderer”:“16.0.0-alpha.12”、“schedule”:“^0.4.0”}、“jest”: { "preset": "react-native" } }
标签: javascript react-native babeljs