Apollo-server: "ApolloServer is not a constructor"

Created on 9 Feb 2019  路  2Comments  路  Source: apollographql/apollo-server

I am using "apollo-server-express": "^2.3.1" and have updated the Core-JS package to "core-js": "^3.0.0-beta.3" yet am still running into this issue. Any advice as to what can be done? Here are the rest of my server-side dependencies:

"dependencies": {
    "apollo-server-express": "^2.3.1",
    "body-parser": "^1.18.3",
    "concurrently": "^4.1.0",
    "core-js": "^3.0.0-beta.3",
    "cors": "^2.8.5",
    "express": "^4.16.4",
    "graphql": "^14.1.1",
    "mongoose": "^5.4.10"
  },
  "devDependencies": {
    "eslint": "^5.3.0",
    "eslint-config-airbnb": "^17.1.0",
    "eslint-plugin-import": "^2.16.0",
    "eslint-plugin-jsx-a11y": "^6.2.1",
    "eslint-plugin-react": "^7.12.4"
  }

Here is my code:

const express = require("express");
const ApolloServer = require("apollo-server-express");
const { typeDefs, resolvers } = require("./graphql/schema");

const app = express();

const server = new ApolloServer({
  typeDefs,
  resolvers,
});

server.applyMiddleware({ app });
const port = process.env.PORT || 5001;
app.listen(port, () => console.log(`Server started on Port ${port}`));

Most helpful comment

I'm getting the same error. How did you resolve this ?

All 2 comments

I'm getting the same error. How did you resolve this ?

Was this page helpful?
0 / 5 - 0 ratings