apollo-client: [3.0.0-beta.24] Module not found: Can't resolve 'apollo-client' in 'node_modules/@apollo/react-hooks/lib'
Upgraded to 3.0.0-beta, everything worked until I did a hard restart of my create-react-app. Upon running my app, I receive the following error:
./node_modules/@apollo/react-hooks/lib/react-hooks.esm.js
Module not found: Can't resolve 'apollo-client' in '/Users/bstrom/dev/reviewtool/node_modules/@apollo/react-hooks/lib'
Versions System: OS: macOS Mojave 10.14.6 Binaries: Node: 12.13.0 - ~/.nvm/versions/node/v12.13.0/bin/node Yarn: 1.21.1 - /usr/local/bin/yarn npm: 6.12.0 - ~/.nvm/versions/node/v12.13.0/bin/npm Browsers: Chrome: 79.0.3945.117 Firefox: 72.0.1 Safari: 13.0.4 npmPackages: @apollo/client: ^3.0.0-beta.24 => 3.0.0-beta.24 @apollo/react-hooks: ^3.1.3 => 3.1.3 @apollo/react-testing: ^3.1.3 => 3.1.3 apollo-cache-inmemory: ^1.6.5 => 1.6.5 apollo-link: ^1.2.13 => 1.2.13 apollo-link-error: ^1.1.12 => 1.1.12 apollo-link-http: ^1.5.16 => 1.5.16 apollo-server: ^2.9.7 => 2.9.15 –>
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 17 (3 by maintainers)
@bstro we haven’t quite finished our migration guide yet (it should be done this upcoming week), but React Apollo’s hooks are now included in
@apollo/client. You can (and should) drop your@apollo/react-hooksdependency, and instead import directly from@apollo/client.Thank you @mhuconcern ! Based on what you said, I looked into it further and realized there was a beta version of react-ssr ( “@apollo/react-ssr”: “^4.0.0-beta.1”), and that fixed it upon updating. Seems like the old ssr had the hooks dependency, and that was my problem!
@mshahbazm because @latest is stable. you need to use @beta
You can always check what versions are available on the Versions Tab on npm: https://www.npmjs.com/package/@apollo/react-components?activeTab=versions
@TheoMer Are you using next-with-apollo? I was facing this issue today. You’ll need to install the latest 5.0 version. Because some of my code is still not refactored to hooks I also needed to use @apollo/react-components@beta. Also if you want to use SSR you need to install @apollo/react-ssr@beta and then import
getDataFromTreeand pass it:This solves my issue but I noticed you added this to your release milestone so I’ll leave this open. Thank you for getting back to me so quickly.