Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module build failed: TypeError: Property right of AssignmentExpression expected node to be of a type ["Expression"] but instead got null at Array.map (native) #7831

Closed
BigFaceMaster opened this issue Apr 28, 2018 · 27 comments
Labels
Needs Info outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@BigFaceMaster
Copy link

Choose one: is this a bug report or feature request?

Input Code

var your => (code) => here;

Babel/Babylon Configuration (.babelrc, package.json, cli command)

{
  "your": { "config": "here" }
}

Expected Behavior

Current Behavior

Possible Solution

Context

Your Environment

software version(s)
Babel
Babylon
node
npm
Operating System
@babel-bot
Copy link
Collaborator

Hey @leejay1992! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community that typically always has someone willing to help. You can sign-up here
for an invite.

@nicolo-ribaudo
Copy link
Member

Please fill the issue template

@babel-bot
Copy link
Collaborator

Hi @leejay1992! A maintainer of the project has notified me that you're missing
some information we'll need to replicate this issue.

Please understand that we receive a high volume of issues, and there are only a limited number
of volunteers that help maintain this project. The easier it is for us to decipher an issue with the info provided,
the more likely it is that we'll be able to help.

Please make sure you have the following information documented in this ticket:

  1. Your Babel configuration (typically in the form of a .babelrc)
  2. The current (incorrect) behavior you're seeing
  3. The behavior you expect
  4. A short, self-contained example

Please provide either a link to the problem via the repl, or if the repl is insufficient,
a new and minimal repository with instructions on how to build/replicate the issue.

@cburbank
Copy link

cburbank commented Apr 29, 2018

@leejay1992 I started seeing this error after upgrading my project to babel beta 46 (was previously on beta 44), and it seems it may indicate some conflict between babel plugins. In my case I was able to resolve it by removing babel-plugin-transform-decorators-legacy and adding "decoratorsLegacy": true to the @babel/env @babel/stage-0 preset options.

@BingoBinBingo
Copy link

Good Nice

@somonek
Copy link

somonek commented May 8, 2018

@cburbank's solution didn't work for me, but I was able to solve it by having the decorators plugin like this:

{
  "presets": [
    "@babel/preset-react",
    ["@babel/preset-env", {
      "targets": {
        "browsers": ["last 2 versions"]
      }
    }]
  ],
  "plugins": [
    ["@babel/plugin-proposal-decorators", {
      "legacy": true
    }],
    "react-hot-loader/babel",
    "@babel/plugin-proposal-class-properties",
    "@babel/plugin-proposal-object-rest-spread",
    "@babel/plugin-syntax-export-extensions",
    "transform-function-bind"
  ]
}

@capaj
Copy link

capaj commented May 11, 2018

@somonek thanks for your comment-I've also resolved this issue by replacing the plugin:

image

@hyochan
Copy link

hyochan commented Jul 5, 2018

image

I am suffering from this issue in react-native@0.56 any idea? Related to issue.

@TitanKing
Copy link

@dooboolab Did you manage to find a solution for this?

@hyochan
Copy link

hyochan commented Jul 5, 2018

@TitanKing No. I've wasted a day to solve this problem. What's funny is, it works ok when I use typescript. I feel like babel@7 is facing many issues currently.

@TitanKing
Copy link

@dooboolab Yeah I cannot spend days trying to get past this. Oh well, reverting is the only option then I guess. Thanks for the feedback.

@mCodex
Copy link

mCodex commented Jul 5, 2018

I've also tried:

  "resolutions": {
    "babel-core": "^7.0.0-bridge.0"
  },

in my package.json and then:

rm -rf node_modules/ yarn.lock && yarn

but still doesn't work :/

@dimapaloskin
Copy link

Looks like this bug related with this commit: b8dcd6f
which totally renamed callee to expression

The quick fix:
https://github.com/babel/babel/blob/master/packages/babel-plugin-proposal-decorators/src/transformer-legacy.js#L49

const expression = decorator.expression; -> const expression = decorator.expression || decorator.callee

@nicolo-ribaudo
Copy link
Member

@dimapaloskin That is only a problem when you are using different versions of the various packages.

@xuqinggang
Copy link

Note: please ensure babel plugin package version is consistent!
image

@nicolo-ribaudo
Copy link
Member

You shouldn't use ^ in beta versions: they could get out of sync

@rknell
Copy link

rknell commented Jul 18, 2018

@TitanKing @dooboolab I found it, I found it, I found it!

Righto - so metro bundler in react native 0.56 only supports babel 7 beta v47

Which means its actually due to a version mismatch, just not one in your package.json. I solved this by looking at the missing peer dependencies when running yarn - So if this changes in the future and causes the same issue, check the yarn output.

So what I did was

package.json

  "devDependencies": {
    "@babel/core": "7.0.0-beta.47",
    "@babel/plugin-proposal-decorators": "7.0.0-beta.47",
    "@babel/plugin-transform-runtime": "7.0.0-beta.47",
    "@babel/runtime": "7.0.0-beta.47",
    ...

.babelrc

{
  "presets": [
    "react-native"
  ],
  "plugins": [
    [
      "@babel/plugin-proposal-decorators",
      {
        "legacy": true
      }
    ],
    [
      "@babel/plugin-transform-runtime",
      {
        "helpers": true,
        "polyfill": false,
        "regenerator": false
      }
    ]
  ]
}

Note: I did need to remove @babel/parser as it was first introduced in beta 48

@hyochan
Copy link

hyochan commented Jul 18, 2018

@rknell Thanks. My app is running now. However, there is another problem left for me which is jest. It works fine when I downgrade to react-native@0.55.4 but throws error message in 0.56.

 Requires Babel "^7.0.0-0", but was loaded with "6.26.3". If you are sure you have a compatible version of @babel/core, it is likely that something in your build process is loading the wrong version. Inspect the stack trace of this error to look for the first entry that doesn't mention "@babel/core" or "babel-core" to see what is calling Babel.

If you also face the build error in configuring jest, look up issue which solved my problem.
The important part is changing jest configuration in package.json.

"^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js",

Thank you by the way with the decorator issue.

hyochan added a commit to dooboolab-community/dooboo-native-js that referenced this issue Jul 18, 2018
@hvaoc
Copy link

hvaoc commented Jul 18, 2018

I got the same error when adding Mobx support to my react native project.

Changes suggested by @dooboolab above fixed this error for me.

Am using "react-native": "^0.56.0".

@mehulmpt
Copy link

Yes. Downgrading to 0.47 version fixes the problem. I'm keeping dependencies as:

  "@babel/core": "7.0.0-beta.47",
   "@babel/plugin-proposal-optional-chaining": "7.0.0-beta.47",
   "@babel/preset-env": "7.0.0-beta.47",
   "@babel/preset-stage-2": "7.0.0-beta.47",

before babel 7 is stable for react native

@existentialism
Copy link
Member

@mehulmpt just to clarify: “babel 7 is stable for react native”... it is, it’s just that all your @babel/* dependencies need to fixed to matching versions, and since RN is currently using beta47, you must too.

@mehulmpt
Copy link

mehulmpt commented Jul 21, 2018

Yeah, I meant to say "before we can do semver for babel 7 packages for react native" @existentialism

@schumannd
Copy link

@somonek s answer solved it for me:

before:

{
  "presets": ["react-native"],
  "plugins": [
    "transform-decorators-legacy"
  ]
}

after:

{
  "presets": ["react-native"],
  "plugins": [
    ["@babel/plugin-proposal-decorators", {
      "legacy": true
    }],
  ]
}

@rborn
Copy link

rborn commented Sep 5, 2018

@rknell could you please share the whole package.json / .babelrc ?
I'm losing my mind here trying to make mobx run with RN 0.56 in release mode 😹

Thank you 🤗

@hvaoc
Copy link

hvaoc commented Sep 7, 2018

@rborn - Can't let folks suffer...

This is what I am having in my project to make Mobx work with React Native 0.56, hope this helps you all.

.babelrc

{
  "presets": [
    "react-native"
  ],
  "plugins": [
    [
      "@babel/plugin-proposal-decorators",
      {
        "legacy": true
      }
    ]
  ]
}

package.json

{
  "name": "MyProject",
  "version": "0.0.1",
  "dependencies": {
    "@babel/plugin-proposal-decorators": "7.0.0-beta.47",
    "@babel/runtime": "7.0.0-beta.47",
    "add": "^2.0.6",
    "axios": "^0.18.0",
    "deep-object-diff": "^1.1.0",
    "fast-json-patch": "^2.0.7",
    "flat": "^4.1.0",
    "lodash": "^4.17.10",
    "mobx": "^5.0.3",
    "mobx-react": "^5.2.3",
    "react": "16.4.1",
    "react-dom": "^16.4.1",
    "react-native": "^0.56.0",
    "react-native-code-push": "^5.4.1",
    "react-native-country-picker-modal": "^0.6.2",
    "react-native-firebase": "^4.3.7",
    "react-native-form": "^2.1.2",
    "react-native-gifted-chat": "^0.4.3",
    "react-native-lightbox": "git://github.com/oblador/react-native-lightbox.git#0a37652",
    "react-native-linear-gradient": "^2.4.0",
    "react-native-loading-spinner-overlay": "^0.5.2",
    "react-native-segmented-control-tab": "^3.2.2",
    "react-native-text-input-enhance": "^1.0.11",
    "react-native-typography": "^1.3.0",
    "react-native-vector-icons": "^4.6.0",
    "react-navigation": "^2.6.2",
    "react-navigation-header-buttons": "^2.0.1",
    "styled-components": "^3.3.3",
    "uuid": "^3.3.2",
    "yarn": "^1.9.4"
  },
  "devDependencies": {
    "babel-jest": "23.4.0",
    "babel-preset-react-native": "^5",
    "flow-bin": "^0.76.0",
    "jest": "^23.4.1",
    "jsc-android": "^224109.0.0",
    "react-native-cli": "^2.0.1",
    "react-native-rename": "^2.2.2",
    "react-test-renderer": "16.4.1"
  },
  "jest": {
    "preset": "react-native"
  }
}

@rborn
Copy link

rborn commented Sep 9, 2018

@hvaoc I fixed like this:
you need to have .babelrc split in dev/production like here oblador/react-native-vector-icons#801 (comment)

Alsop keep @babel/* vesions to 7.0.0-beta.47

Thanks a lot for your help 🤗

@xtuc
Copy link
Member

xtuc commented Sep 10, 2018

Since no information were provided in the issue initially, I'm going to close this. Please feel free to re-open a new issue.

@xtuc xtuc closed this as completed Sep 10, 2018
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Dec 10, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Dec 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Needs Info outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

No branches or pull requests