Gatsby: Error: Cannot find module 'graphql'

Created on 18 Sep 2018  路  3Comments  路  Source: gatsbyjs/gatsby

Description

After running command to start my new project:

npm install --global gatsby-cli
cd Documents
gatsby new my-app
cd my-app
gatsby develop

I got an error:

error There was a problem loading the local develop command. Gatsby may not be installed. Perhaps you need to run "npm install"?


  Error: Cannot find module 'graphql'

  - module.js:11 require
    internal/module.js:11:18

  - index.js:18 Object.<anonymous>
    [my-app]/[express-graphql]/dist/index.js:18:16

  - module.js:11 require
    internal/module.js:11:18

  - develop.js:17 Object.<anonymous>
    [my-app]/[gatsby]/dist/commands/develop.js:17:21

However, running npm install or rm -rf node_modules and reinstall doesn't work for me.

If i create project based on another starter, it works fine.

gatsby new gatsby-site https://github.com/gatsbyjs/gatsby-starter-hello-world

Environment

  System:
    OS: macOS High Sierra 10.13.6
    CPU: x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 8.11.3 - /usr/local/bin/node
    npm: 5.6.0 - /usr/local/bin/npm
  Browsers:
    Chrome: 68.0.3440.106
    Firefox: 61.0.2
    Safari: 11.1.2
  npmPackages:
    gatsby: ^2.0.0 => 2.0.0
    gatsby-plugin-manifest: ^2.0.2 => 2.0.2
    gatsby-plugin-offline: ^2.0.5 => 2.0.5
    gatsby-plugin-react-helmet: ^3.0.0 => 3.0.0
  npmGlobalPackages:
    gatsby-cli: 2.4.0
question or discussion

Most helpful comment

Yup happening to me too...

EDIT:

  • Removing Gatsby-CLI
  • Updating npm to latest version
  • Installing Gatsby-CLI again

this fixed it for me

All 3 comments

@aalenliang Can you try npm install after removing package-lock.json, yarn.lock and node_modules/?

I'm unable to reproduce this with the steps that you provided.

Hi, I upgrade my npm to 6.4.1, uninstall gatsby globally, and redo the steps.
now it works fine.

Not sure what's wrong. I'll close this issue. Thank you for your reply.

Yup happening to me too...

EDIT:

  • Removing Gatsby-CLI
  • Updating npm to latest version
  • Installing Gatsby-CLI again

this fixed it for me

Was this page helpful?
0 / 5 - 0 ratings