Hi!
When I run webpack for my project, this is what I get:
ERROR in ./~/graphql-tag/src/index.js
Module not found: Error: Can't resolve 'graphql/language/parser' in '/Users/victorbarbu/Desktop/Dev/wallpapers-app-ws/node_modules/graphql-tag/src'
@ ./~/graphql-tag/src/index.js 1:13-47
@ ./~/react-apollo/react-apollo.browser.umd.js
@ ./resources/client/ui/App.js
@ ./resources/client/entry/app.js
ERROR in ./~/react-apollo/~/apollo-client/index.js
Module not found: Error: Can't resolve 'graphql/language/printer' in '/Users/victorbarbu/Desktop/Dev/wallpapers-app-ws/node_modules/react-apollo/node_modules/apollo-client'
@ ./~/react-apollo/~/apollo-client/index.js 3:0-50
@ ./~/react-apollo/react-apollo.browser.umd.js
@ ./resources/client/ui/App.js
@ ./resources/client/entry/app.js
ERROR in ./~/react-apollo/~/apollo-client/transport/networkInterface.js
Module not found: Error: Can't resolve 'graphql/language/printer' in '/Users/victorbarbu/Desktop/Dev/wallpapers-app-ws/node_modules/react-apollo/node_modules/apollo-client/transport'
@ ./~/react-apollo/~/apollo-client/transport/networkInterface.js 20:0-49
@ ./~/react-apollo/~/apollo-client/index.js
@ ./~/react-apollo/react-apollo.browser.umd.js
@ ./resources/client/ui/App.js
@ ./resources/client/entry/app.js
ERROR in ./~/react-apollo/~/apollo-client/core/QueryManager.js
Module not found: Error: Can't resolve 'graphql/language/printer' in '/Users/victorbarbu/Desktop/Dev/wallpapers-app-ws/node_modules/react-apollo/node_modules/apollo-client/core'
@ ./~/react-apollo/~/apollo-client/core/QueryManager.js 21:0-49
@ ./~/react-apollo/~/apollo-client/ApolloClient.js
@ ./~/react-apollo/~/apollo-client/index.js
@ ./~/react-apollo/react-apollo.browser.umd.js
@ ./resources/client/ui/App.js
@ ./resources/client/entry/app.js
ERROR in ./~/react-apollo/~/apollo-client/transport/Deduplicator.js
Module not found: Error: Can't resolve 'graphql/language/printer' in '/Users/victorbarbu/Desktop/Dev/wallpapers-app-ws/node_modules/react-apollo/node_modules/apollo-client/transport'
@ ./~/react-apollo/~/apollo-client/transport/Deduplicator.js 1:0-50
@ ./~/react-apollo/~/apollo-client/core/QueryManager.js
@ ./~/react-apollo/~/apollo-client/ApolloClient.js
@ ./~/react-apollo/~/apollo-client/index.js
@ ./~/react-apollo/react-apollo.browser.umd.js
@ ./resources/client/ui/App.js
@ ./resources/client/entry/app.js
Here is my package.json file:
"devDependencies": {
"webpack": "^2.7.0",
// ...
},
"dependencies": {
"apollo-client": "^1.9.0-1",
"react-apollo": "^1.4.8",
// ...
},
What can I do?
@barbu110 can you run npm I --save graphql?
This issue has been automatically labled because it has not had recent activity. If you have not received a response from anyone, please mention the repository maintainer (most likely @jbaxleyiii). It will be closed if no further activity occurs. Thank you for your contributions to React Apollo!
This issue has been automatically closed because it has not had recent activity after being marked as no recent activyt. If you belive this issue is still a problem or should be reopened, please reopen it! Thank you for your contributions to React Apollo!
@jbaxleyiii npm i --save graphql fixed the issue
@jbaxleyiii thanks a lot for your solution :) 馃憤
@barbu110 can you run
npm I --save graphql?
That would be incorrect cause IMHO you can only call "i" lowercase otherwise will throw error.
You can also use yarn:
yarn add graphql --dev
Stupid question, but still... Why does react-apollo have graphql as devDependency and not as dependency then?
@rkosenko It has it as a devDependency because it's needed by the react-apollo test suite. But it also has it as a peerDependency, which means react-apollo is expecting it to be installed and available separately. It's set as a peer dep since most people using react-apollo are using one or more other libraries that require graphql, and grapqhl doesn't play nicely with multiple versions of itself in your dep tree.
might help someone from going mad / bald: https://github.com/apollographql/apollo-client/issues/4764
Thanks @aldegoeij!
Also, I originally ran: npm i apollo-boost @apollo/react-hooks. Shouldn't one of those two packages have depended on graphgql? If they had, wouldn't that have made NPM install the graphql package for me, avoiding all this?
npm i -S graphql
fixed the issue
npm i --save graphql fixed the issue. No I prefix.
I stil get Module not found: Can't resolve 'graphql/language/parser' even though graphql is installed.
https://github.com/apollographql/react-apollo/issues/922#issuecomment-472073965
You can also use yarn:
yarn add graphql --dev
After this comment , I had another error
Module not found: Can't resolve 'react-apollo'
I had installed react-apollo but it wasn't on my package.json anymore
I run yarn add react-apollo and my react compiled succesfully
THank you
Most helpful comment
@barbu110 can you run
npm I --save graphql?