Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find module '@graphql-inspector/graphql-cli-common' in @graphql-cli/diff #1814

Closed
Tracked by #2441
schie opened this issue Jan 5, 2021 · 3 comments
Closed
Tracked by #2441
Labels
area/cli 🐞 bug Something isn't working

Comments

@schie
Copy link

schie commented Jan 5, 2021

Describe the bug

Error when trying to generate code w/ graphql-cli

To Reproduce
Steps to reproduce the behavior:

  1. create a new project that uses GraphQL-CLI
  2. run the added script graphql:codegen
  3. get the following error
$ graphql codegen
(node:44387) UnhandledPromiseRejectionWarning: Error: Cannot find module '@graphql-inspector/graphql-cli-common'
Require stack:
- /path/to/project/node_modules/@graphql-cli/diff/index.cjs.js
- /path/to/project/node_modules/graphql-cli/dist/index.js
- /path/to/project/node_modules/graphql-cli/dist/bin.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
    at Function.Module._load (internal/modules/cjs/loader.js:841:27)
    at Module.require (internal/modules/cjs/loader.js:1025:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/path/to/project/node_modules/@graphql-cli/diff/index.cjs.js:5:26)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Module.require (internal/modules/cjs/loader.js:1025:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at loadCommand (/path/to/project/node_modules/graphql-cli/dist/index.js:46:17)
    at Array.map (<anonymous>)
    at Object.cli (/path/to/project/node_modules/graphql-cli/dist/index.js:17:68)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:44387) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:44387) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
✨  Done in 3.43s.

Expected behavior

I expect an error to not be thrown and for it do generate code.

Environment:

  • OS: Mac OS 11.1
  • @graphql-cli/diff
  • graphql:
  • NodeJS: v12.18.3

Additional context

When going through the stack trace, it is being caused by a missing dependency.

"dependencies": {
"@graphql-cli/common": "4.1.0",
"@graphql-cli/loaders": "4.1.0",
"@graphql-inspector/diff-command": "0.0.0-PLACEHOLDER",
"tslib": "^2.0.0"
},

import {
GlobalArgs,
parseGlobalArgs,
createInspectorExtension,
loaders,
} from '@graphql-inspector/graphql-cli-common';

@slagiewka
Copy link

I am playing with graphql-cli and came across the same issue.

Adding that dependency manually to my project made it work, but this is definitely not the way to go.

@kamilkisiela kamilkisiela added area/cli 🐞 bug Something isn't working labels Feb 16, 2021
@imbayard
Copy link

I'm also facing that issue while playing with graphql-cli...

And when I manually try to add the dependency, it looks like there are some peer deps that cause an issue.

peer graphql-config@"^3.0.0" from @graphql-inspector/[email protected]

but graphql-config is up to at least 4.4.1 now...

@theguild-bot theguild-bot mentioned this issue Apr 16, 2023
39 tasks
@TuvalSimha
Copy link
Collaborator

Hey @imbayard,
Still happened? We are fixed some issues with peerDependencies:

  1. Using pnpm
  2. Build the packages with new bob version (esm and cjs)
  3. peerDependencies using workspace: *

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli 🐞 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants