graphql: Cannot find module '@apollo/gateway' or its corresponding type declarations.

I’m submitting a…


[ ] Regression 
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

There is a problem with dependencies.

node_modules/@nestjs/graphql/dist/interfaces/gql-gateway-module-options.interface.d.ts:1:58 - error TS2307: Cannot find module '@apollo/gateway' or its corresponding type declarations.

1 import { GatewayConfig, ServiceEndpointDefinition } from '@apollo/gateway';
                                                           ~~~~~~~~~~~~~~~~~

node_modules/@nestjs/graphql/dist/interfaces/gql-gateway-module-options.interface.d.ts:2:35 - error TS2307: Cannot find module '@apollo/gateway/src/datasources/types' or its corresponding type declarations.

2 import { GraphQLDataSource } from '@apollo/gateway/src/datasources/types';

Environment


"@nestjs/common": "^7.2.0",
"@nestjs/core": "^7.2.0",
"@nestjs/graphql": "^7.4.5",
"@nestjs/platform-express": "^7.1.2",
"@types/graphql-relay": "^0.6.0",
"apollo-server-express": "^2.15.0",
"graphql": "^15.1.0",
"graphql-tools": "^6.0.10",

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 10
  • Comments: 30 (2 by maintainers)

Most upvoted comments

For nvm

I solved my problem by installing node 14.0.0.

This issue occurs also with node 16

Still can replicate by following the Introduction Alternatives guide. Cloned the repo and got the same error.

@kamilmysliwiec could you check this, please? Thank you!

This issue should be fixed in 7.4.6. Let me know if you still face any errors.

I went back to node LTS (14.17) and it now works as intended!!

I had the same issue. I had everything up to date, but my node version was v10.x.x. I need to upgrade my local node version to the latest LTS (v12.18.2) and now it works. Maybe it helps someone.

I just got this error when doing a minor upgrade to “@nestjs/graphql”: “^7.10.3” “apollo-server-express”: “^2.22.2”

reinstalled everything, nvm use 14, npm clean-install and it’s running again. Seems to be busted in Node 15

I don’t understand why it doesn’t get loaded by Yarn. You have to add @apollo/gateway explicitly as dev dependency to your project.

I was using node version: FROM node:15.2.0-alpine3.10 changed to FROM node:14.16.0-alpine3.10

and it worked.

error solved by updating each of these packages @nestjs/common @nestjs/core @nestjs/platform-express to 7.4.4

I fear this issue is not fixed yet, since i’m facing this with what seems to be a up-date version: ^8.0.2 Also my node version should be compatible according to what others said here: v14.16.0 I tried npm and yarn, neither worked. 😕

It looks like @apollo/gateway is currently unsupported in node >= 15… They have a plan to update the package when node 16 turns LTS. Here for more info.

However, if you are really into making it work in node version >= 15, and If you are in a controlled environment, you can do rm -rf node_modules && yarn --ignore-engines. But again, it’s not recommended, but it works if you are, as in my case, doing a side project or something.

I solved my problem by downgrade version of node to v14.16.1 and delete node_modules folder and install it again in my project it worked now.

Fresh install on node 15 and latest libs with apollo etc, still get the same error. Fixed by separately installing @apollo/gateway. I assume then this issue has not yet been fixed?