Closed dclipca closed 4 years ago
could you verify in your lockfile / node_modules
which version of mobx-react-lite is installed? should be 3.0.0 at least
@mweststrate Isn't the path wrong here?
node_modules/mobx-react-lite/es/assertEnvironment
Should be in utils
dir ... https://unpkg.com/browse/mobx-react-lite@3.0.0/es/utils/
What I mean is the assertEnvironment
is used by mobx-react-lite
internally only. How is it possible something else is importing it from a different path?
@virtumonde yeah that sounds like you have somehow a hardcoded import into the mobx-react-library somewhere? VSCode tends to do that sometimes :-P. I suspect this issue is further unrelated to the actual package. That file has moved indeed recently, but is internal so should not affect anything.
@mweststrate
"mobx-react": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/mobx-react/-/mobx-react-7.0.0.tgz",
"integrity": "sha512-yxbTG+ovn/GbgF3+QdQahkL5sXiITtwvkoXM6PNqd0V4jvO53cnr/YM4PYuA+0Ig95IW1nojA3qViJx9ufJm6w==",
"requires": {
"mobx-react-lite": "^3.0.0"
}
},
"mobx-react-lite": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/mobx-react-lite/-/mobx-react-lite-3.0.0.tgz",
"integrity": "sha512-SJgrTD9mfClFOsamB+0y6zjteSMr4gkp9usnpIeEi8E+lW3lMgDa3hnD4PJgLGoENpJ8/9OmO3vrkA50SNy0mw=="
},
@mweststrate let me look into it.
@mweststrate by hardcoded import you mean I am myself trying to access node_modules/mobx-react-lite/es/index.js
? I've scanned my project for this kind of imports and didn't find anything. Let's wait to see if other people encounter this error.
yes
On Thu, Oct 1, 2020 at 2:44 PM Dan Clipca notifications@github.com wrote:
@mweststrate https://github.com/mweststrate by hardcoded import you mean I am myself trying to access node_modules/mobx-react-lite/es/index.js ?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mobxjs/mobx-react/issues/899#issuecomment-702145603, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAN4NBABVZOMB5LV35LVQCTSISBVDANCNFSM4SALP44A .
having something in the form of import from "mobx-react-lite/something"
On Thu, Oct 1, 2020 at 2:46 PM Michel Weststrate mweststrate@gmail.com wrote:
yes
On Thu, Oct 1, 2020 at 2:44 PM Dan Clipca notifications@github.com wrote:
@mweststrate https://github.com/mweststrate by hardcoded import you mean I am myself trying to access node_modules/mobx-react-lite/es/index.js?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mobxjs/mobx-react/issues/899#issuecomment-702145603, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAN4NBABVZOMB5LV35LVQCTSISBVDANCNFSM4SALP44A .
@mweststrate the only mention of mobx-react-lite
is in my package-lock.json
. I am sure that my code does not import it. Maybe other packages might import it? Here are my dependencies:
"dependencies": {
"@react-native-community/async-storage": "^1.12.0",
"@react-native-firebase/app": "^8.4.5",
"@react-native-firebase/crashlytics": "^8.4.8",
"@react-native-mapbox-gl/maps": "^8.1.0-rc.4",
"google-protobuf": "^3.13.0",
"grpc-web": "^1.2.1",
"lottie-react-native": "^3.5.0",
"mobx": "^6.0.0",
"mobx-react": "^7.0.0",
"react": "16.13.1",
"react-native": "0.63.3",
"react-native-action-button": "^2.8.5",
"react-native-modal": "^11.5.6",
"react-native-permissions": "^2.2.2",
"react-native-popup-menu": "^0.15.9",
"react-native-safe-area-context": "^3.1.8",
"react-native-sound": "^0.11.0",
"react-native-toast-message": "^1.3.3",
"react-native-vector-icons": "^7.1.0"
},
"devDependencies": {
"@babel/core": "^7.11.6",
"@babel/plugin-proposal-class-properties": "^7.10.4",
"@babel/plugin-proposal-decorators": "^7.10.5",
"@babel/runtime": "^7.11.2",
"@react-native-community/eslint-config": "^2.0.0",
"@types/geojson": "^7946.0.7",
"@types/jest": "^26.0.14",
"@types/react-native": "^0.63.23",
"@types/react-test-renderer": "^16.9.3",
"@types/uuid-parse": "^1.0.0",
"@typescript-eslint/eslint-plugin": "^4.3.0",
"@typescript-eslint/parser": "^4.3.0",
"@types/google-protobuf": "^3.7.3",
"@types/react-native-vector-icons": "^6.4.6",
"babel-jest": "^26.3.0",
"eslint": "^7.10.0",
"jest": "^26.4.2",
"metro-react-native-babel-preset": "^0.63.0",
"prettier": "^2.1.2",
"react-test-renderer": "16.13.1",
"typescript": "^4.0.3"
}
Also, switching back to "mobx-react": "^6.3.0"
and "mobx": "^6.0.0"
doesn't trigger the error.
Something is apparently importing the old file. Maybe even some sort of cache? Might be even duplicate versions of packages. I recommend deleting node_modules and reinstalling from the scratch.
@FredyC I already did that 5 times. I will look into other possibilities soon as for now this is not critical to me.
If switching to mobx-react:6.3 and mobx:6 does work for you, there is definitely something wrong, as those should normally not be able to work together :-P. There is something weird, are you sure you have cleared all caches, have the same folder open in terminal, ide and project that is running, etc? Otherwise I recommend to build a minimal repro, usually the process of doing that finds the culprit
On Thu, Oct 1, 2020 at 2:55 PM Dan Clipca notifications@github.com wrote:
@FredyC https://github.com/FredyC I already did that 5 times. I will look into other possibilities soon as for now this is not critical to me.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mobxjs/mobx-react/issues/899#issuecomment-702152939, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAN4NBHRF44T2FSJ6B4RYUTSISC6LANCNFSM4SALP44A .
@mweststrate I meant "mobx": "^5.15.7"
instead of "mobx": "^6.0.0"
. My bad.
ok, nonetheless would be great to build a minimal reproduction. Might be an uncommon module format or something that messes things up.
Just for confirmation, I just tried both a fresh CRA and a fresh RN project with mobx@6 + mobx-react@7 and they work fine. So this really seems to be a local issue. You can try to run yarn why mobx-react-lite
(or the other 2) to see if another package accidentally brings a different version of those packages.
Healthy output looks like:
yarn why mobx-react-lite
yarn why v1.22.4
[1/4] 🤔 Why do we have the module "mobx-react-lite"...?
[2/4] 🚚 Initialising dependency graph...
[3/4] 🔍 Finding dependency...
[4/4] 🚡 Calculating file sizes...
=> Found "mobx-react-lite@3.0.0"
info Reasons this module exists
- "mobx-react" depends on it
- Hoisted from "mobx-react#mobx-react-lite"
info Disk size without dependencies: "316KB"
info Disk size with unique dependencies: "316KB"
info Disk size with transitive dependencies: "316KB"
info Number of shared dependencies: 0
✨ Done in 0.48s.
Closing until more info becomes available
After upgrading from
"mobx": "^5.15.7"
and"mobx-react": "^6.3.0"
to"mobx": "^6.0.0"
and"mobx-react": "^7.0.0"
I receive anUnable to resolve module `./assertEnvironment
error.Intended outcome
The app doesn't have any errors
Actual outcome
How to reproduce the issue
Install
"mobx": "^6.0.0"
and"mobx-react": "^7.0.0"
on"react-native": "0.63.3"
Versions