confuser/graphql-constraint-directive

Cannot find module 'graphql-tag'

VicDario opened this issue · 3 comments

Hi. I'm updating to v5 and after follow the example in the readme. I found this error.

[nodemon] starting `node ./bin/www`
node:internal/modules/cjs/loader:998
  throw err;
  ^

Error: Cannot find module 'graphql-tag'
Require stack:
- /home/vicdario/work/base-proyectos-graphql/node_modules/graphql-constraint-directive/apollo4.js
- /home/vicdario/work/base-proyectos-graphql/src/graphql/index.js
- /home/vicdario/work/base-proyectos-graphql/src/index.js
- /home/vicdario/work/base-proyectos-graphql/bin/www
    at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
    at Module._load (node:internal/modules/cjs/loader:841:27)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (/home/vicdario/work/base-proyectos-graphql/node_modules/graphql-constraint-directive/apollo4.js:7:17)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Module._load (node:internal/modules/cjs/loader:878:12)
    at Module.require (node:internal/modules/cjs/loader:1061:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/vicdario/work/base-proyectos-graphql/node_modules/graphql-constraint-directive/apollo4.js',
    '/home/vicdario/work/base-proyectos-graphql/src/graphql/index.js',
    '/home/vicdario/work/base-proyectos-graphql/src/index.js',
    '/home/vicdario/work/base-proyectos-graphql/bin/www'
  ]
}

Node.js v18.12.1

I'm running on WSL Ubuntu 22.04.1 LTS

Thanks for reporting. Thing is that this dependency is only necessary for Apollo 4 plugin, so it is probably not desirable to have it in dependencies nor peerDependencies. Maybe we should better document which dependencies are required for which plugin in the README.md, but let it on clients to install these dependencies independently.

harnyk commented

TBH, I do not see any reason stopping you from adding this to at least peerDependencies. Developers who migrate to Apollo 4 will be confused again and again by this error.

Closing in favour of #156