-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
WebSocket registerEvents
is undefined when running master
#20567
Comments
I've seen this as well when experimenting with different versions of Babel but still using version 0.56 of React (by overriding the dependency resolution). Could be that a simple bump of Babel could fix this, could you try adding the following to your package.json to force a newer babel? "resolutions": {
"**/@babel/code-frame": "7.0.0-beta.56",
"**/@babel/core": "7.0.0-beta.56",
"**/@babel/generator": "7.0.0-beta.56",
"**/@babel/helper-annotate-as-pure": "7.0.0-beta.56",
"**/@babel/helper-builder-binary-assignment-operator-visitor": "7.0.0-beta.56",
"**/@babel/helper-builder-react-jsx": "7.0.0-beta.56",
"**/@babel/helper-call-delegate": "7.0.0-beta.56",
"**/@babel/helper-define-map": "7.0.0-beta.56",
"**/@babel/helper-explode-assignable-expression": "7.0.0-beta.56",
"**/@babel/helper-function-name": "7.0.0-beta.56",
"**/@babel/helper-get-function-arity": "7.0.0-beta.56",
"**/@babel/helper-hoist-variables": "7.0.0-beta.56",
"**/@babel/helper-member-expression-to-functions": "7.0.0-beta.56",
"**/@babel/helper-module-imports": "7.0.0-beta.56",
"**/@babel/helper-module-transforms": "7.0.0-beta.56",
"**/@babel/helper-optimise-call-expression": "7.0.0-beta.56",
"**/@babel/helper-plugin-utils": "7.0.0-beta.56",
"**/@babel/helper-regex": "7.0.0-beta.56",
"**/@babel/helper-remap-async-to-generator": "7.0.0-beta.56",
"**/@babel/helper-replace-supers": "7.0.0-beta.56",
"**/@babel/helper-simple-access": "7.0.0-beta.56",
"**/@babel/helper-split-export-declaration": "7.0.0-beta.56",
"**/@babel/helper-wrap-function": "7.0.0-beta.56",
"**/@babel/helpers": "7.0.0-beta.56",
"**/@babel/highlight": "7.0.0-beta.56",
"**/@babel/plugin-external-helpers": "7.0.0-beta.56",
"**/@babel/plugin-proposal-class-properties": "7.0.0-beta.56",
"**/@babel/plugin-proposal-object-rest-spread": "7.0.0-beta.56",
"**/@babel/plugin-proposal-optional-chaining": "7.0.0-beta.56",
"**/@babel/plugin-syntax-class-properties": "7.0.0-beta.56",
"**/@babel/plugin-syntax-dynamic-import": "7.0.0-beta.56",
"**/@babel/plugin-syntax-flow": "7.0.0-beta.56",
"**/@babel/plugin-syntax-jsx": "7.0.0-beta.56",
"**/@babel/plugin-syntax-nullish-coalescing-operator": "7.0.0-beta.56",
"**/@babel/plugin-syntax-object-rest-spread": "7.0.0-beta.56",
"**/@babel/plugin-syntax-optional-chaining": "7.0.0-beta.56",
"**/@babel/plugin-transform-arrow-functions": "7.0.0-beta.56",
"**/@babel/plugin-transform-async-to-generator": "7.0.0-beta.56",
"**/@babel/plugin-transform-block-scoping": "7.0.0-beta.56",
"**/@babel/plugin-transform-classes": "7.0.0-beta.56",
"**/@babel/plugin-transform-computed-properties": "7.0.0-beta.56",
"**/@babel/plugin-transform-destructuring": "7.0.0-beta.56",
"**/@babel/plugin-transform-exponentiation-operator": "7.0.0-beta.56",
"**/@babel/plugin-transform-flow-strip-types": "7.0.0-beta.56",
"**/@babel/plugin-transform-for-of": "7.0.0-beta.56",
"**/@babel/plugin-transform-function-name": "7.0.0-beta.56",
"**/@babel/plugin-transform-literals": "7.0.0-beta.56",
"**/@babel/plugin-transform-modules-commonjs": "7.0.0-beta.56",
"**/@babel/plugin-transform-object-assign": "7.0.0-beta.56",
"**/@babel/plugin-transform-parameters": "7.0.0-beta.56",
"**/@babel/plugin-transform-react-display-name": "7.0.0-beta.56",
"**/@babel/plugin-transform-react-jsx": "7.0.0-beta.56",
"**/@babel/plugin-transform-react-jsx-source": "7.0.0-beta.56",
"**/@babel/plugin-transform-regenerator": "7.0.0-beta.56",
"**/@babel/plugin-transform-shorthand-properties": "7.0.0-beta.56",
"**/@babel/plugin-transform-spread": "7.0.0-beta.56",
"**/@babel/plugin-transform-sticky-regex": "7.0.0-beta.56",
"**/@babel/plugin-transform-template-literals": "7.0.0-beta.56",
"**/@babel/plugin-transform-unicode-regex": "7.0.0-beta.56",
"**/@babel/register": "7.0.0-beta.56",
"**/@babel/template": "7.0.0-beta.56",
"**/@babel/traverse": "7.0.0-beta.56",
"**/@babel/types": "7.0.0-beta.56"
}, If this solves it, we could just bump Babel in Metro, bump Metro, and then bump Metro here in React Native 😄 |
Here is a pull request to Babel, that was also needed for an unrelated bug with exporting interfaces from a TypeScript file: facebook/metro#216 |
I'm concerned this is potentially related to the @grabbou can you upload the RN init'd project that the command generated? BTW the correct version of babel to set the |
This can be related to Instead of that, it should add the Another thing that I've just realized is that the |
Unfortunately, the error still happens after performing the suggested changes. I am going to put them all into a PR anyway so that master can be up to date. |
CC: @hramos and @axemclion - you might be able to make this issue more visible - it's currently blocking the release. I don't know the React Native |
Related: 7e61f43 which we should, once we fixed, cherrypick back to master. |
Just tried again with using latest ✅ It's surely related to babel, and the config. I've tried changing the babel-preset dept from
that was suggested here. Even if I completely remove the Just to make sure that it is in fact a babel related issue I double checked where the error was coming from (here) and if I "bruteforcefully" comment out that section, the error actually changes to I have spent a couple hrs now on it and I'm quite confident that it's either:
Either case, I think @hramos that the metro team should take a closer look at it, it is also probably related to the many breaking changes Babel7 has undergone from Or maybe I'm missing something simpler and @hzoo has a 1-line solution to all our issues 😇 |
Thanks for the detailed investigation @kelset! Thanks to this I've been able to debug the issue and found that the root cause is the Babel preset that's on the template's I think that @kelset was not able to find it because So there are two potential solutions here:
|
Here is a PR for switching the preset 👉 #20653 |
Summary: @public While debugging a RN 0.57 blocking issue, we found that the `--reset-cache` cli arg is not being passed to Metro (more info: #20567 (comment)). This diff fixes this issue Reviewed By: mjesun Differential Revision: D9295634 fbshipit-source-id: a53ec7abff2b7e684a1fd88c3b53ff0b54a1c3c4
Summary: @public While debugging a RN 0.57 blocking issue, we found that the `--reset-cache` cli arg is not being passed to Metro (more info: #20567 (comment)). This diff fixes this issue Reviewed By: mjesun Differential Revision: D9295634 fbshipit-source-id: a53ec7abff2b7e684a1fd88c3b53ff0b54a1c3c4
I've updated the 0.57 branch to be in sync with master and tested the changes, and I don't know why but I still, following the list of steps I listed above, get the I'll keep this open until we are sure it's fixed. BTW, if not I apply manually the changes to package.json and .babelrc it works fine! So yeah we are getting close 💪 |
Hmm, running react-native init Foobar --version /Users/linus/coding/react-native/react-native-1000.0.0.tgz This should be how the |
Yes I can confirm now that it was a caching issue on the machine, I've just tested with another laptop and the project gets generated correctly 🎉 I'll close this and try to have the first RC0 release for 0.57 out asap. |
This comment has been minimized.
This comment has been minimized.
Summary: @public While debugging a RN 0.57 blocking issue, we found that the `--reset-cache` cli arg is not being passed to Metro (more info: facebook/react-native#20567 (comment)). This diff fixes this issue Reviewed By: mjesun Differential Revision: D9295634 fbshipit-source-id: a53ec7abff2b7e684a1fd88c3b53ff0b54a1c3c4
@kelset how do you resolve caching issue? Please, tell |
@NelGarbuzova I just restarted the machine, It looks like the error is different now I get an error on StackNavigator (undefined is not a function) with which I assume it has reseted the cache. |
Restart the machine |
It works for me... |
Environment
Description
The following error is produced as soon as you run the app:
The following line https://github.com/facebook/react-native/blob/master/Libraries/WebSocket/WebSocket.js#L147 produces an error - for some reason
_registerEvents()
is not available onthis
, even though you can see it defined as a class method. Is this something related to Babel transpilation?Reproducible Demo
Running freshly created app with
0.57-stable
(react-native init
). Interestingly, RNTester (that runs on the same React Native version) works just fine. I'll keep debugging babel differences in setups to see why it could be occuring. Help appreciated.The text was updated successfully, but these errors were encountered: