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

Regression: Unable to resolve module 'scheduler/tracing' in ReactNative 0.59.3 #24573

Closed
pgruenbaum opened this issue Apr 23, 2019 · 16 comments
Closed
Labels
Bug Impact: Regression Describes a behavior that used to work on a prior release, but stopped working recently. Resolution: Locked This issue was locked by the bot. Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used.

Comments

@pgruenbaum
Copy link

pgruenbaum commented Apr 23, 2019

💥 Regression Report

I am trying to upgrade to RN 0.59.3 from RN 0.56 (my understanding is that I need 0.59 to get 64 bit, required by Play Store by August). I am seeing an "Unable to resolve module 'scheduler/tracing'" message when the app loads on both an Android simulator and device. (Note that it says "scheduler/tracing", not "schedule/tracking", like it does in some other issues posted here.)

Screen Shot 2019-04-23 at 11 57 17 AM

I tried using version 16.6.0-alpha.8af6728 since that was suggested here, but no difference. I believe that RN 0.59 needs react 16.8.

Here's the thing that's really strange. I tried creating a new RN 0.59 project through react-native init. It's essentially AwesomeProject. When I run it, I get the same error. The error refers to directories in my old project, despite the fact that I have created this new project in a completely different directory. I tried changing the directory that the old project is in, but the error refers to the original project directory. So it's as if something got cached. I tried uninstalling react-native-cli and react-native, and then reinstalling them, but no result. I removed the node_modules directory and did an npm install, but that hasn't had an effect either.

Last working version

Worked up to version: 0.56

Stopped working in version: 0.59

To Reproduce

Given that I am seeing this error when I do a react-native init, I'm not sure how you can reproduce it.

Expected Behavior

Should run without the red screen with error showing up.

Code Example

Given that I am seeing this error when I do a react-native init, I'm not sure how you can reproduce it. If need be, I can create a repo with the original project, but I suspect something else is going on. Here is my package.json file:

{
"name": "Transfusion",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.8.3",
"react-native": "^0.59.5"
},
"devDependencies": {
"@babel/core": "7.4.3",
"@babel/runtime": "^7.4.3",
"babel-jest": "24.7.1",
"jest": "24.7.1",
"metro-react-native-babel-preset": "0.53.1",
"react-test-renderer": "16.8.3"
},
"jest": {
"preset": "react-native"
}
}

Environment

System:
OS: macOS 10.14.4
CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
Memory: 307.59 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.7.0 - /usr/local/bin/node
npm: 6.2.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
IDEs:
Android Studio: 3.2 AI-181.5540.7.32.5056338
Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: ^0.59.5 => 0.59.5
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7
react-native: 0.59.3

@pgruenbaum pgruenbaum added Impact: Regression Describes a behavior that used to work on a prior release, but stopped working recently. Type: Bug Report labels Apr 23, 2019
@react-native-bot react-native-bot added the Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used. label Apr 23, 2019
@react-native-bot
Copy link
Collaborator

Can you run react-native info and edit your issue to include these results under the Environment section?

If you believe this information is irrelevant to the reported issue, you may write `[skip envinfo]` alongside an explanation in your Environment: section.

@pgruenbaum
Copy link
Author

I did have the react-native info output in the environment section. I just removed the leading indent -- maybe the bot will recognize it now.

@pgruenbaum pgruenbaum changed the title Regression: Unable to resolve module 'scheduler/tracing' in ReactNative Regression: Unable to resolve module 'scheduler/tracing' in ReactNative 0.59.3 Apr 23, 2019
@thymikee
Copy link
Contributor

This is likely a result of bad cache and clearing node modules (happens when upgrading). Please reinstall node_modules followed by restart of packager and its cache with yarn react-native start --reset-cache. That should help. Also, please remove global react-native package, it should be installed globally (it's different than react-native-cli)

@pgruenbaum
Copy link
Author

Thanks @thymikee, that now works at least for the blank project. (I have a new error for my original project, which I will try to figure out before posting another issue.)

I would love it if when you searched on "clear cache" in the React Native documentation, that it would tell you to do yarn react-native start --reset-cache. If you just do a Google search on "react native clear cache", you get all kinds of suggestions (most often npm cache clean --force), but I never came across the yarn command.

@thymikee
Copy link
Contributor

we should make --clear-cache and maybe --cache-clear another aliases to --reset-cache :) Feel free to contribute this change: https://github.com/react-native-community/cli/blob/master/packages/cli/src/commands/server/server.js#L76 (cli uses commander btw)

@pgruenbaum
Copy link
Author

Actually, my complaint was more about knowing to use yarn rather than reset-cache vs clear-cache. If you go to the React Native documentation and search on "reset cache", you still won't get any useful information.

Once I cleared the cache as you suggested, my project was seeing the issue described here I tried implementing the suggestion to add the metro-react-native-babel-preset package, and that got rid of that error, but created a new one: Can't find variable Intl. Let me know if you have suggestions.

Screen Shot 2019-04-25 at 4 55 51 PM

@thymikee
Copy link
Contributor

Typing yarn something tries to run npm-script called "something" and falls back to trying "something" binary if that's available in your node_modules, so it's just a convenient way to call node ./node_modules/.bin/react-native start :).

Do you use a variable Intl somewhere? I've never seen this error before, but looks like it's coming from PagerAndroid - maybe that's something you need to upgrade as well

@pgruenbaum
Copy link
Author

Yeah, sorry, I should have checked my code for Intl. Not a variable, but part of a module that I installed but wasn't really using, so forgot about. I got rid of it, and now I have a new error. I'll bang my head against that one and open a new issue if I can't figure it out.

@pgruenbaum
Copy link
Author

Hey @thymikee, one more quick question: is there any other way to clear the cache? I now have an error: undefined is not an object (evaluating '_reactNative.Modal.propTypes.animationType'). I removed all references to animationType from my project, and I am still getting this error. I tried running my blank project, and I get the exact same error. So that suggests that it's a caching problem. I did a yarn react-native start --reset-cache, as well as:
watchman watch-del-all && rm -rf $TMPDIR/react-native-packager-cache-* && rm -rf $TMPDIR/metro-bundler-cache-* && rm -rf node_modules/ && npm cache clean --force && npm install
but I am still getting that error. Is there some cache that I am missing?
Screen Shot 2019-04-29 at 11 11 33 AM

@pgruenbaum
Copy link
Author

pgruenbaum commented Apr 29, 2019

Just realized I was doing yarn react-native start --reset-cache in the wrong directory! The blank project works fine now. So it's not a caching issue after all.

@pgruenbaum
Copy link
Author

Resolved: I ended up creating a new project with react-native init and moving all of my source code and assets into it. It was a pain, but less of a pain than the constant stream of random errors when trying to upgrade the original project. Now just trying to get it into the Google Play Store...

@kingsman7
Copy link

that is no solution

@rajnishcoder
Copy link

rajnishcoder commented Jul 11, 2019

Any update on this? resetting cache did no fixed it.

@Ethan0007
Copy link

if you are using "react-native": "^0.59.8", update your react to "react": "16.8.5".

@Aakashsajjad095
Copy link

its work for me
npm cache clean --force

@faisal3413
Copy link

cache resetting, force cache clean and other proposed solutions are not working. Any solid solution for this ?

@facebook facebook locked as resolved and limited conversation to collaborators Apr 25, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Impact: Regression Describes a behavior that used to work on a prior release, but stopped working recently. Resolution: Locked This issue was locked by the bot. Tech: Bundler 📦 This issue is related to the bundler (Metro, Haul, etc) used.
Projects
None yet
Development

No branches or pull requests

8 participants