user3125971
user3125971

Reputation: 139

Import Error: Cannot find module 'graphql' from 'apollo-link-state/lib/bundle.umd.js

I am trying to setup React/Apollo frontend with graphql backend(elixir/phoenix). I did npm install apollo-boost react-apollo graphql --save and then tried to import ApolloClient from "apollo-boost"; in my index.js but I am getting

Uncaught Error: Cannot find module 'graphql' from 'apollo-link-state/lib/bundle.umd.js'
    at require (app.js:61)
    at expanded (app.js:34)
    at app.js:148
    at connectionRemoveConfig.test (bundle.umd.js:6)
    at bundle.umd.js:9
    at bundle.umd.js:151
    at initModule (app.js:42)
    at require (app.js:59)
    at expanded (app.js:34)
    at app.js:148

in my browser console. I couldn't find any related question. Can you point what went wrong? Here is my package.json.

{
  "repository": {},
  "license": "MIT",
  "scripts": {
    "deploy": "brunch build --production",
    "watch": "brunch watch --stdin"
  },
  "dependencies": {
    "apollo-boost": "^0.1.16",
    "babel-preset-react": "^6.24.1",
    "graphql": "^14.0.2",
    "phoenix": "file:../deps/phoenix",
    "phoenix_html": "file:../deps/phoenix_html",
    "react": "^16.5.1",
    "react-apollo": "^2.1.11",
    "react-dom": "^16.5.1"
  },
  "devDependencies": {
    "babel-brunch": "6.1.1",
    "brunch": "2.10.9",
    "clean-css-brunch": "2.10.0",
    "uglify-js-brunch": "2.10.0"
  }
}

Thank you for your time.

Upvotes: 3

Views: 11239

Answers (1)

user3125971
user3125971

Reputation: 139

I solved it by installing them separately.npm install apollo-client apollo-cache-inmemory apollo-link-http react-apollo graphql-tag graphql --save

Upvotes: 5

Related Questions