babel: Module build failed: TypeError: Property right of AssignmentExpression expected node to be of a type ["Expression"] but instead got null at Array.map (native)
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 |
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 27 (5 by maintainers)
@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 theyarn
output.So what I did was
package.json
.babelrc
Note: I did need to remove @babel/parser as it was first introduced in beta 48
I am suffering from this issue in
react-native@0.56
any idea? Related to issue.@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.@somonek thanks for your comment-I’ve also resolved this issue by replacing the plugin:
@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
package.json
@dooboolab Did you manage to find a solution for this?
@cburbank’s solution didn’t work for me, but I was able to solve it by having the decorators plugin like this:
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.
@hvaoc I fixed like this: you need to have
.babelrc
split in dev/production like here https://github.com/oblador/react-native-vector-icons/issues/801#issuecomment-409268915Alsop keep
@babel/*
vesions to7.0.0-beta.47
Thanks a lot for your help 🤗
@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 🤗
@somonek s answer solved it for me:
before:
after:
Yeah, I meant to say “before we can do semver for babel 7 packages for react native” @existentialism
@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.
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”.
@dimapaloskin That is only a problem when you are using different versions of the various packages.
Looks like this bug related with this commit: https://github.com/babel/babel/commit/b8dcd6f593955be2779b770182a4e8930288cdaa which totally renamed
callee
toexpression
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
Good Nice