-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Error: While trying to resolve module @apollo/client React Native #9194
Comments
Same issue here. Updated from v 3. |
@dragoshuniq @AustinHunt Please see the notice about reconfiguring Metro (to enable the |
@benjamn I already tried this solution. But getting something like this |
@benjamn solved this by following those instructions. Thanks. |
@dragoshuniq That looks like a different problem (no mention of If the other problem turns out to be related to Apollo Client, please do open a follow-up issue! |
@benjamn I'm also getting @dragoshuniq's error, I've updated the metro config so it correctly uses cjs, but then all imports from @apollo/client return undefined. Downgrading to a 3.4.x version works, so its definitely an issue with Apollo Client. Though I do get the same error as @dragoshuniq, before that I get this:
I believe the "Invariant Violation: "main" has not been registered." error happens just because nothing is rendered. |
I have a repro here as part of my teams boilerplate, its part of a monorepo in packages/app. |
Nevermind, I was adding cjs to the assetExts instead of sourceExts... Adding this to metro.config works config.resolver.sourceExts.push("cjs") |
I am using Recoil. After modifying metro.config.js, the following error occurs. error: Error: Unable to resolve module react-dom from /Users/pruge/..../node_modules/recoil/cjs/recoil.js:
react-dom could not be found within the project or in these directories:
node_modules
../../../../node_modules
If you are sure the module exists, try these steps:
1. Clear watchman watches: watchman watch-del-all
2. Delete node_modules and run yarn install
3. Reset Metro's cache: yarn start --reset-cache
4. Remove the cache: rm -rf /tmp/metro-*
6 |
7 | var react = _interopDefault(require('react'));
> 8 | var reactDom = _interopDefault(require('react-dom'));
| ^
9 |
10 | /**
11 | * Copyright (c) Facebook, Inc. and its affiliates. |
@pruge I added |
Hi @zenato thanks for replying. I tried using @apollo/client@3.5.6 and the same error occurred. |
If anyones trying to do this on expo try.
|
It is working just fine, this is my setup
then run |
These workarounds break my AWS Amplify Cognito Authentication in React Native. Will there be a fix in the future that does not require the workaround? |
AWS closed the same issue on their end because they consider it a third party library issue. Seems like we are getting stuck in a catch 22 situation. |
after installing new version of apollo client getting this Error. I tried other versions and to downgrade but nothing. Also I tried to specify in metro.config.js to resolve "cjs" type of file (@apollo/client/main.cjs), but nothing.
Error
error: Error: While trying to resolve module @apollo/client from file ****\src\api\queries\home.js, the package ****\node_modules\@apollo\client\package.json was successfully found. However, this package itself specifies a main module field that could not be resolved (****\node_modules\@apollo\client\main.cjs. Indeed, none of these files exist:
package.json
"graphql": "^15.4.0", "@apollo/client": "^3.3.2",
The text was updated successfully, but these errors were encountered: