apollo-express-server has a dependency on express to run (see
|
import express from 'express'; |
) but it isn't listed in the dependencies of its
package.json -
Typically, this shouldn't cause issues as you'd only be using it in an express-based project, but if you aren't directly including express but instead using a private wrapper package which adds boilerplate, npm won't know to make express available to apollo-express-server, throwing the error:
internal/modules/cjs/loader.js:584 throw err;
^
Error: Cannot find module 'express'
The solution is to add express to either the dependencies or peerDependencies of apollo-express-server.
apollo-express-server has a dependency on
expressto run (seeapollo-server/packages/apollo-server-express/src/ApolloServer.ts
Line 1 in 6d9c3b8
package.json-apollo-server/packages/apollo-server-express/package.json
Line 28 in 6d9c3b8
Typically, this shouldn't cause issues as you'd only be using it in an express-based project, but if you aren't directly including express but instead using a private wrapper package which adds boilerplate, npm won't know to make express available to apollo-express-server, throwing the error:
The solution is to add express to either the dependencies or peerDependencies of apollo-express-server.