错误:捆绑失败:TypeError:无法读取null的属性“绑定” [英] error: bundling failed: TypeError: Cannot read property 'bindings' of null

查看:136
本文介绍了错误:捆绑失败:TypeError:无法读取null的属性“绑定”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在运行react-native应用程序时也面临同样的问题。我使用的版本如下:

I am also facing a same issue while running the react-native app. The version i am using is as follows:

React-Native:0.57.1​​
react-native-cli:2.0.1
节点: v8.11.3
npm:5.6.0

React-Native:0.57.1 react-native-cli:2.0.1 node:v8.11.3 npm:5.6.0

Babel版本详细信息:

Babel Version details:


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:{预设: react-native}}

"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" } }

错误:


错误:捆绑失败:TypeError:无法在Scope.moveBindingTo读取
null
的属性'绑定'(/ 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-tr ansform-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)
at TraversalContext.visitQueue(/home/manish/Desktop/Practice/donut/node_modules/@babel/traverse/lib/context.js:118:16 )
BUNDLE [android,dev] ./index.android.js░░░░░░░░░░░░░░░░0.0%
(0/3):: ffff:127.0 .0.1 - - [01 / Oct / 2018:05:31:17 +0000]GE T
/index.android.delta?platform=android&dev=true&minify=false HTTP / 1.1
500 - - okhttp / 3.10.0BUNDLE [android,dev]。 /index.android.js $ b $b░░░░░░░░░░░░░░░░0.0%(0/3),失败。

error: bundling failed: TypeError: Cannot read property 'bindings' of null at Scope.moveBindingTo (/home/manish/Desktop/Practice/donut/node_modules/@babel/traverse/lib/scope/index.js:867:13) at BlockScoping.updateScopeInfo (/home/manish/Desktop/Practice/donut/node_modules/babel-plugin-transform-es2015-block-scoping/lib/index.js:364:17) at BlockScoping.run (/home/manish/Desktop/Practice/donut/node_modules/babel-plugin-transform-es2015-block-scoping/lib/index.js:330:12) at PluginPass.BlockStatementSwitchStatementProgram (/home/manish/Desktop/Practice/donut/node_modules/babel-plugin-transform-es2015-block-scoping/lib/index.js:70:24) at newFn (/home/manish/Desktop/Practice/donut/node_modules/@babel/traverse/lib/visitors.js:193:21) at NodePath._call (/home/manish/Desktop/Practice/donut/node_modules/@babel/traverse/lib/path/context.js:53:20) at NodePath.call (/home/manish/Desktop/Practice/donut/node_modules/@babel/traverse/lib/path/context.js:40:17) at NodePath.visit (/home/manish/Desktop/Practice/donut/node_modules/@babel/traverse/lib/path/context.js:88:12) at TraversalContext.visitQueue (/home/manish/Desktop/Practice/donut/node_modules/@babel/traverse/lib/context.js:118:16) BUNDLE [android, dev] ./index.android.js ░░░░░░░░░░░░░░░░ 0.0% (0/3)::ffff:127.0.0.1 - - [01/Oct/2018:05:31:17 +0000] "GET /index.android.delta?platform=android&dev=true&minify=false HTTP/1.1" 500 - "-" "okhttp/3.10.0" BUNDLE [android, dev] ./index.android.js ░░░░░░░░░░░░░░░░ 0.0% (0/3), failed.

似乎错误是由于babel而来。但无法获得解决方案。这个问题的解决方案是什么?

It seems as if error is coming due to babel. But not able to get the solution. What is the solution for this issue ?

推荐答案

我使用 babel-preset-react-native 依赖于已被弃用的metro-react-native-babel-preset:现在正在使用^ 0.47.0。所以,我在 .babelrc 文件中对此进行了更新,并添加了以下行:

I was using babel-preset-react-native in dependency which has been deprecated instead "metro-react-native-babel-preset": "^0.47.0" is now being used. So, I updated this in .babelrc file and I added the below line:

{
  "presets": ["module:metro-react-native-babel-preset"]
}

上述代码解决了这个问题。

The above code resolved the issue.

这篇关于错误:捆绑失败:TypeError:无法读取null的属性“绑定”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆