danielrvt
danielrvt

Reputation: 10906

React Native: Android build - App.js: Cannot read property 'bindings' of null

I'm trying to build my project, but it has tuned into a nightmare...

Now I'm facing this issue when I run ./gradlew assembleRelease

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

And more specifically:

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)

I honestly have absolutely no idea what's wrong now, how can I debug this?

This is my package.json:

{
    "name": "my-app",
    "version": "0.0.1",
    "private": true,
    "scripts": {
        "start": "node node_modules/react-native/local-cli/cli.js start",
        "test": "jest"
    },
    "dependencies": {
        "@ptomasroos/react-native-multi-slider": "0.0.12",
        "firebase": "^5.1.0",
        "javascript-time-ago": "^1.0.30",
        "mobx": "^4.1.1",
        "mobx-react": "^5.0.0",
        "native-base": "^2.8.1",
        "prop-types": "^15.6.2",
        "protobufjs": "^6.8.8",
        "react": "16.2.0",
        "react-native": "^0.57.7",
        "react-native-actionsheet": "^2.3.0",
        "react-native-aws3": "0.0.8",
        "react-native-axios": "^0.17.1",
        "react-native-billing": "^2.9.1",
        "react-native-card-stack-swiper": "^1.0.5",
        "react-native-collapsible": "^0.10.0",
        "react-native-cookies": "^3.2.0",
        "react-native-datepicker": "^1.6.0",
        "react-native-dropdownalert": "^3.5.0",
        "react-native-elements": "^0.19.0",
        "react-native-event-listeners": "^1.0.3",
        "react-native-expandable-section-flatlist": "^1.0.3",
        "react-native-fbsdk": "^0.8.0",
        "react-native-fcm": "^16.0.0",
        "react-native-floating-action": "^1.10.1",
        "react-native-geocoding": "^0.3.0",
        "react-native-gifted-chat": "^0.4.3",
        "react-native-google-places-autocomplete": "^1.3.6",
        "react-native-hide-show-password-input": "^1.0.7",
        "react-native-image-crop-picker": "^0.19.3",
        "react-native-image-picker": "^0.26.10",
        "react-native-image-placeholder": "^1.0.14",
        "react-native-instagram-login": "^1.0.7",
        "react-native-keyboard-aware-scroll-view": "^0.4.4",
        "react-native-keyboard-aware-scrollview": "^2.0.0",
        "react-native-keyboard-spacer": "^0.4.1",
        "react-native-linear-gradient": "^2.4.0",
        "react-native-linkedin": "^1.3.1",
        "react-native-localization": "^2.0.0",
        "react-native-material-bottom-navigation": "^0.9.0",
        "react-native-modal-datetime-picker": "^6.0.0",
        "react-native-open-settings": "^1.0.1",
        "react-native-pages": "^0.7.0",
        "react-native-permissions": "^1.1.1",
        "react-native-picker-select": "^5.1.0",
        "react-native-popup-menu": "^0.12.4",
        "react-native-pulse": "^1.0.6",
        "react-native-scrollable-tab-view": "^0.8.0",
        "react-native-share": "^1.0.26",
        "react-native-simple-toast": "0.0.8",
        "react-native-snap-carousel": "^3.7.2",
        "react-native-splash-screen": "^3.1.1",
        "react-native-star-rating": "^1.0.9",
        "react-native-swipe-cards": "^0.1.1",
        "react-native-swipe-list-view": "^1.0.7",
        "react-native-swipeable-flat-list": "0.0.5",
        "react-native-swipeout": "^2.3.3",
        "react-native-switch": "^1.4.0",
        "react-native-twitter-signin": "https://github.com/GoldenOwlAsia/react-native-twitter-signin.git#master",
        "react-native-view-more-text": "^2.0.1",
        "react-native-viewpager": "^0.2.13",
        "react-navigation": "^1.0.3",
        "rn-viewpager": "^1.2.9"
    },
    "devDependencies": {
        "@babel/plugin-proposal-decorators": "^7.2.0",
        "babel-jest": "22.2.2",
        "babel-preset-react-native": "4.0.0",
        "jest": "22.2.2",
        "react-test-renderer": "16.2.0"
    },
    "jest": {
        "preset": "react-native",
        "transform": {
            "^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js"
        }
    }
}

Upvotes: 0

Views: 1475

Answers (2)

digit
digit

Reputation: 4565

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

babel-preset-react-native has been replaced by metro-react-native-babel-preset, which now uses Babel 7.0.0. If you're using React Native v0.57 or later you should update your babel config to point to the metro-react-native-babel-preset preset.

Upvotes: 3

Chad Nehemiah
Chad Nehemiah

Reputation: 881

I think this may be related to a particular issue with babel-core, you could try this solution https://github.com/babel/babel/issues/8263#issuecomment-402546923

Add to your package.json

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

and then npm install

Upvotes: 0

Related Questions