question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot find module graphql

See original GitHub issue

After installing with npm install -g graphql-code-generator, I get the following error:

MacBook-Pro-2:stephanie-website ed$ gql-gen init
internal/modules/cjs/loader.js:582
    throw err;
    ^

Error: Cannot find module 'graphql'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
    at Function.Module._load (internal/modules/cjs/loader.js:506:25)
    at Module.require (internal/modules/cjs/loader.js:636:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/opt/local/lib/node_modules/graphql-code-generator/dist/load.js:39:17)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)

I’m using npm 6.5.0 Mac OS Mojave, npm is installed from Macports.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
ardatancommented, Dec 28, 2018

Did you try to run npm i graphql?

2reactions
dotansimhacommented, Feb 14, 2019

@reconbot graphql is defined as devDependency and as peerDependency. We don’t want to force a specific version of graphql because it might result in multiple copies of graphql (and that’s not a good thing, because it will produce Also ensure that there are not multiple versions of GraphQL installed in your node_modules directory. errors).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot find module 'graphql' from 'apollo-link-state/lib/bundle ...
I am trying to setup React/Apollo frontend with graphql backend(elixir/phoenix). I did npm ...
Read more >
graphql - npm
This defines a simple schema, with one type and one field, that resolves to a fixed value. The resolve function can return a...
Read more >
Codegen:generate error, cannot find module 'graphql ...
I had successfully been able to run the following command over the past couple of weeks. But today I was faced with an...
Read more >
error: cannot find module 'graphql/language/parser' - You.com
1. The issue provides a reproduction available on GitHub, Stackblitz or CodeSandbox > Make sure to fork this template and run yarn generate...
Read more >
Cannot find module 'types/graphql' or its corresponding type ...
Ok,. So I generate a cell in a typescript project and it's complaining Cannot find module 'types/graphql' or its corresponding type ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found