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

Comments

Projects
None yet
@BigFaceMaster

BigFaceMaster commented Apr 28, 2018

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

This comment has been minimized.

Show comment
Hide comment
@babel-bot

babel-bot Apr 28, 2018

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.

Collaborator

babel-bot commented Apr 28, 2018

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

This comment has been minimized.

Show comment
Hide comment
@nicolo-ribaudo

nicolo-ribaudo Apr 28, 2018

Member

Please fill the issue template

Member

nicolo-ribaudo commented Apr 28, 2018

Please fill the issue template

@babel-bot

This comment has been minimized.

Show comment
Hide comment
@babel-bot

babel-bot Apr 28, 2018

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.

Collaborator

babel-bot commented Apr 28, 2018

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

This comment has been minimized.

Show comment
Hide comment
@cburbank

cburbank 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.

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

This comment has been minimized.

Show comment
Hide comment
@BingoBinBingo

BingoBinBingo commented May 7, 2018

Good Nice

@somonek

This comment has been minimized.

Show comment
Hide comment
@somonek

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

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

This comment has been minimized.

Show comment
Hide comment
@capaj

capaj May 11, 2018

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

image

capaj commented May 11, 2018

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

image

@dooboolab

This comment has been minimized.

Show comment
Hide comment
@dooboolab

dooboolab Jul 5, 2018

image

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

dooboolab commented Jul 5, 2018

image

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

@TitanKing

This comment has been minimized.

Show comment
Hide comment
@TitanKing

TitanKing Jul 5, 2018

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

TitanKing commented Jul 5, 2018

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

@dooboolab

This comment has been minimized.

Show comment
Hide comment
@dooboolab

dooboolab 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.

dooboolab 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

This comment has been minimized.

Show comment
Hide comment
@TitanKing

TitanKing Jul 5, 2018

@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.

TitanKing commented Jul 5, 2018

@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

This comment has been minimized.

Show comment
Hide comment
@mCodex

mCodex 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 :/

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

This comment has been minimized.

Show comment
Hide comment
@dimapaloskin

dimapaloskin Jul 7, 2018

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

dimapaloskin commented Jul 7, 2018

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

This comment has been minimized.

Show comment
Hide comment
@nicolo-ribaudo

nicolo-ribaudo Jul 7, 2018

Member

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

Member

nicolo-ribaudo commented Jul 7, 2018

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

@xuqinggang

This comment has been minimized.

Show comment
Hide comment
@xuqinggang

xuqinggang Jul 11, 2018

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

xuqinggang commented Jul 11, 2018

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

@nicolo-ribaudo

This comment has been minimized.

Show comment
Hide comment
@nicolo-ribaudo

nicolo-ribaudo Jul 11, 2018

Member

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

Member

nicolo-ribaudo commented Jul 11, 2018

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

@rknell

This comment has been minimized.

Show comment
Hide comment
@rknell

rknell 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

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

@dooboolab

This comment has been minimized.

Show comment
Hide comment
@dooboolab

dooboolab 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.

dooboolab 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.

dooboolab added a commit to react-native-seoul/react-native-js-boilerplate that referenced this issue Jul 18, 2018

@hvaoc

This comment has been minimized.

Show comment
Hide comment
@hvaoc

hvaoc 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".

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

This comment has been minimized.

Show comment
Hide comment
@mehulmpt

mehulmpt Jul 21, 2018

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

mehulmpt commented Jul 21, 2018

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

This comment has been minimized.

Show comment
Hide comment
@existentialism

existentialism Jul 21, 2018

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.

Member

existentialism commented Jul 21, 2018

@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

This comment has been minimized.

Show comment
Hide comment
@mehulmpt

mehulmpt Jul 21, 2018

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

mehulmpt commented Jul 21, 2018

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

@schumannd

This comment has been minimized.

Show comment
Hide comment
@schumannd

schumannd Sep 1, 2018

@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
    }],
  ]
}

schumannd commented Sep 1, 2018

@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

This comment has been minimized.

Show comment
Hide comment
@rborn

rborn 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 🤗

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

This comment has been minimized.

Show comment
Hide comment
@hvaoc

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

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

This comment has been minimized.

Show comment
Hide comment
@rborn

rborn 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 🤗

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

This comment has been minimized.

Show comment
Hide comment
@xtuc

xtuc Sep 10, 2018

Member

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

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 Sep 10, 2018

@takion takion referenced this issue Sep 10, 2018

Open

Bundle failure on decorators #19955

3 of 3 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment