Problem: Cannot find 'react-apollo' when importing
I created a minimal repo to reproduce the issue.
https://github.com/marcelofpalves/react-apollo-crashing-example
The main entry on the package.json has this path:
"main": "lib/index.js"
But in node_modules/react-apollo/lib there is no index.js on that folder.
Maybe there is an issue with the build.
Thank you.
Hm, did I not publish this correctly? 馃
edit: looking at the repo I didn't see a publish or deploy script, so I assumed I could just run npm publish.
Set the latest tag to 0.7.2 while I try to figure out what's going on.
If I can't figure it out, we might need @jbaxleyiii 's help here.
Was just about to release 0.8.1, but I think @jbaxleyiii beat me to it. 馃槂
@marcelofpalves @Grmiade @pradel @JacobSoderblom Please give this comment a thumbs up if it works for you now, thumbs down if it doesn't. Thanks!
@helfer thank you
I updated the example with v0.8.1 (https://github.com/marcelofpalves/react-apollo-crashing-example)
now it breaks with
ERROR in ./~/react-apollo/lib/browser.js
Module build failed: Error: Couldn't find preset "react-native" relative to directory "/Users/marcelo.pereira/Desktop/react-apollo-crashing-example/node_modules/react-apollo"
at /Users/marcelo.pereira/Desktop/react-apollo-crashing-example/node_modules/babel-core/lib/transformation/file/options/option-manager.js:299:19
at Array.map (native)
can anyone reproduce this?
@marcelopereirascmspain did you update your reproduction? It will hopefully help us figure out what's going on.
@helfer I did.
I put the link in the comment above. Hopefully it will help.
Ok, thanks! It's getting quite late here, so I hope someone else can pick this up tomorrow morning and fix it! 馃檪
I see :) Thank you for your time!
+1
I'm getting the same error with "react-apollo": "^0.8.1", and it went away after installing "babel-preset-react-native": "^1.9.1".
For anyone who stumbles across this issue who is also using Webpack, I was able to resolve the react-native related error message by ignoring the node_modules folder in babel-loader:
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
options: { }
}
We also faced this issue, and in our case, the issue was that we had defined a 'react-apollo': 'react-apollo/lib/browser' alias in our Webpack config to optimize our bundle size. Apparently, this doesn't work anymore for some reason, so removing this alias fixed our build.
I was following this tutorial: https://dev-blog.apollodata.com/full-stack-react-graphql-tutorial-582ac8d24e3b
I am getting the same error with
"react": "^16.3.2",
"react-apollo": "^2.1.4",
I tried to solve this problem by importing apollo-client separately with https://www.npmjs.com/package/apollo-client
Yet, it does not work
"apollo-client": "^2.3.1",
"react": "^16.3.2",
"react-apollo": "^2.1.4",
I am getting an error described here: https://github.com/apollographql/react-apollo/issues/1339
Now checking https://www.apollographql.com/docs/react/recipes/2.0-migration.html#install
I had this issue with "react-apollo": "^2.1.6",
yarn add apollo-client resolved it.
I had this issue with
"react-apollo": "^2.1.6",
yarn add apollo-clientresolved it.
Wow, this fixed my issue also! Thanks!
yarn add apollo-client resolved it.
This solved it for me as well.
If you're in a typescript project like you may fix issue by updating tsconfig.json, I was surprised to see the error go away:
- "target": "es2015"
+ "lib": ["es2015"]
yarn add apollo-client
THIS ALSO FIXED IT FOR ME! Thanks so much!
Most helpful comment
I had this issue with
"react-apollo": "^2.1.6",yarn add apollo-clientresolved it.