React Native:Android构建-App.js:无法读取null的属性'bindings'

时间:2018-12-12 22:49:51

标签: android react-native react-native-android

我正在尝试构建我的项目,但是它已变成噩梦...

现在,我在运行 @echo off python -m robot %*

时遇到此问题
./gradlew assembleRelease

更具体地说:

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:bundleReleaseJsAndAssets'.

老实说,我绝对不知道现在出了什么问题,该如何调试呢?

这是我的 package.json

transform[stderr]: Trace: The node type SpreadProperty has been renamed to SpreadElement
transform[stderr]:     at Object.isSpreadProperty (/Users/danielrvt/IdeaProjects/my-app/node_modules/@babel/types/lib/validators/generated/index.js:4208:11)
transform[stderr]:     at hasSpread (/Users/danielrvt/IdeaProjects/my-app/node_modules/babel-plugin-transform-object-rest-spread/lib/index.js:38:13)
transform[stderr]:     at PluginPass.ObjectExpression (/Users/danielrvt/IdeaProjects/my-app/node_modules/babel-plugin-transform-object-rest-spread/lib/index.js:234:14)
transform[stderr]:     at newFn (/Users/danielrvt/IdeaProjects/my-app/node_modules/@babel/traverse/lib/visitors.js:193:21)
transform[stderr]:     at NodePath._call (/Users/danielrvt/IdeaProjects/my-app/node_modules/@babel/traverse/lib/path/context.js:53:20)
transform[stderr]:     at NodePath.call (/Users/danielrvt/IdeaProjects/my-app/node_modules/@babel/traverse/lib/path/context.js:40:17)
transform[stderr]:     at NodePath.visit (/Users/danielrvt/IdeaProjects/my-app/node_modules/@babel/traverse/lib/path/context.js:88:12)
transform[stderr]:     at TraversalContext.visitQueue (/Users/danielrvt/IdeaProjects/my-app/node_modules/@babel/traverse/lib/context.js:118:16)
transform[stderr]:     at TraversalContext.visitSingle (/Users/danielrvt/IdeaProjects/my-app/node_modules/@babel/traverse/lib/context.js:90:19)
transform[stderr]:     at TraversalContext.visit (/Users/danielrvt/IdeaProjects/my-app/node_modules/@babel/traverse/lib/context.js:146:19)

App.js: Cannot read property 'bindings' of null

TypeError: Cannot read property 'bindings' of null
    at Scope.moveBindingTo (/Users/danielrvt/IdeaProjects/my-app/node_modules/@babel/traverse/lib/scope/index.js:867:13)
    at BlockScoping.updateScopeInfo (/Users/danielrvt/IdeaProjects/my-app/node_modules/babel-plugin-transform-es2015-block-scoping/lib/index.js:364:17)
    at BlockScoping.run (/Users/danielrvt/IdeaProjects/my-app/node_modules/babel-plugin-transform-es2015-block-scoping/lib/index.js:330:12)
    at PluginPass.BlockStatementSwitchStatementProgram (/Users/danielrvt/IdeaProjects/my-app/node_modules/babel-plugin-transform-es2015-block-scoping/lib/index.js:70:24)
    at newFn (/Users/danielrvt/IdeaProjects/my-app/node_modules/@babel/traverse/lib/visitors.js:193:21)
    at NodePath._call (/Users/danielrvt/IdeaProjects/my-app/node_modules/@babel/traverse/lib/path/context.js:53:20)
    at NodePath.call (/Users/danielrvt/IdeaProjects/my-app/node_modules/@babel/traverse/lib/path/context.js:40:17)
    at NodePath.visit (/Users/danielrvt/IdeaProjects/my-app/node_modules/@babel/traverse/lib/path/context.js:88:12)
    at TraversalContext.visitQueue (/Users/danielrvt/IdeaProjects/my-app/node_modules/@babel/traverse/lib/context.js:118:16)

2 个答案:

答案 0 :(得分:2)

来自https://www.npmjs.com/package/babel-preset-react-native

  

babel-preset-react-native已替换为   metro-react-native-babel预设,现在使用Babel 7.0.0。如果你是   使用React Native v0.57或更高版本,您应该更新babel配置   指向Metro-react-native-Babel预设预设。

答案 1 :(得分:0)

我认为这可能与JSON.stringify(responseText)的特定问题有关,您可以尝试此解决方案https://github.com/babel/babel/issues/8263#issuecomment-402546923

添加到您的babel-core

package.json

然后是"babel-plugin-transform-object-rest-spread": "^7.0.0-beta.3"