I'm trying to use Expo (sdk 32) + Apollo client for React Native then got message on IOS and Android:
Unable to resolve "../../src/graphql/language/visitor" from "node_modules/apollo-client/bundle.umd.js"
and my package.json:
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"eject": "expo eject",
"test": "node ./node_modules/jest/bin/jest.js --watchAll"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"@expo/samples": "2.1.1",
"apollo-boost": "^0.3.1",
"apollo-cache-inmemory": "^1.5.1",
"apollo-client": "^2.5.1",
"apollo-link-context": "^1.0.17",
"apollo-link-http": "^1.5.14",
"babel-plugin-import": "^1.11.0",
"babel-plugin-module-resolver": "^3.2.0",
"babel-plugin-transform-react-jsx-source": "^6.22.0",
"expo": "^32.0.0",
"graphql": "^14.2.1",
"graphql-tag": "^2.10.1",
"jwt-decode": "^2.2.0",
"moment": "^2.24.0",
"native-base": "^2.12.1",
"react": "16.5.0",
"react-apollo": "^2.5.4",
"react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",
"react-native-modal": "^9.0.0",
"react-native-svg-uri": "^1.2.3",
"react-navigation": "^3.0.9",
"rn-sliding-up-panel": "^2.1.1"
},
"devDependencies": {
"babel-preset-expo": "^5.0.0",
"jest-expo": "^32.0.0"
},
"private": true
}
What's wrong with my package.json ?
There's no module identifier ../../src/graphql/language/visitor
in bundle.umd.js
(or bundle.esm.js
) for [email protected]
, only the (correct) graphql/language/visitor
identifier. This seems like an Expo/RN module system problem.
npm install --save graphql
solved the issue for me
Yeah, that would have been my advice too, but @shanetran's dependencies seem to include graphql
. Perhaps another npm install
would help?
If you have any other questions or you're still having problems with this, feel free to ask in the Apollo community on Spectrum.chat.
I have the same issue on Expo 34, running npm
(or Yarn for that matter) does not work, any other ideas?
馃う鈥嶁檪
馃う鈥嶁檪 馃う鈥嶁檪 馃う鈥嶁檪
As usual, problem between keyboard and chair.
Working with Expo 34, I added an alias to my babel-plugin-module-resolver
config to make reaching my compiled schema code available easier:
"babel-plugin-module-resolver",
{
root: ["./"],
alias: {
assets: "./assets",
graphql: "./src/graphql",
},
},
}
And of course this super 馃う鈥嶁檪 collates with the graphql
npm package that everything related to apollo (and Amplify / AppSync in my case) needs.
Removed the 'graphql' part in babel.config.js
and after running:
watchman watch-del-all && rm -rf ./.cache && rm -rf ./.expo && rm -rf ./public && rm -rf ./node_modules
yarn install
Everything's happilly buzzing along now!
(remember to run expo start --clear
the first time, stuff got stuck there too...)
@aldegoeij thank you so much for sharing this!!! literally was at the error for days and realized that i, too, had a graphql
folder alias that was breaking it.
@aldegoeij same here, thanks! I made so few changes to my packages, and was confused why it wouldn't build... 馃う鈥嶁檪
Most helpful comment
npm install --save graphql
solved the issue for me