Gatsby: Cannot find module 'gatsby/graphql`

Created on 24 Sep 2018  路  9Comments  路  Source: gatsbyjs/gatsby

I am following the Transform Plugins part 6 of the tutorials on the Gatsby website. After I install npm install --save gatsby-transformer-remark and then add it to my gatsby-config.js file As seen below. Only when I add the gatsby-transformer-remark and I stop gatsby and run gatsby develop I get the following error Error: Cannot find module 'gatsby/graphql' However if I delete the line from my gatsby-config and run gatsby develop everything works again

module.exports = {
    siteMetadata: {
        title: `Panda Panda Panda`,
    },
    plugins: [
        {
            resolve: `gatsby-source-filesystem`,
            options: {
                name: `src`,
                path: `${__dirname}/src/`,
            },
        },
      `gatsby-transformer-remark`,
      `gatsby-plugin-glamor`,
      {
        resolve: `gatsby-plugin-typography`,
        options: {
          pathToConfigModule: `src/utils/typography`,
        },
      },
    ],
  };
awaiting author response needs more info

Most helpful comment

This was useful. Thanks @mikelax 馃樅 . Thanks @nicolasrouanne 馃樅. Thanks @anderskitson 馃樅

All 9 comments

@anderskitson can you provide the relevant environment information by running gatsby info --clipboard in your project?

hmm, when I run that command Gatsby complains and gives me the command options, basically saying it does not recognize that command, I tried just gatsby info on its own and got the same response

What is the gatsby-cli version that you are using currently? You can check that using gatsby -v.

1.1.50

@anderskitson can you try updating your gatsby-cli version to the latest?

I got the same error than above: Error: Cannot find module 'gatsby/graphql'

This happened after installing gatsby-transformer-sharp as a plugin (so slightly different than @anderskitson) on a previously fine working Gatsby install.

Here is my config

System:
    OS: macOS High Sierra 10.13.6
    CPU: x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 8.12.0 - ~/.nvm/versions/node/v8.12.0/bin/node
    Yarn: 1.7.0 - /usr/local/bin/yarn
    npm: 6.4.1 - ~/.nvm/versions/node/v8.12.0/bin/npm
  Browsers:
    Chrome: 69.0.3497.100
    Firefox: 62.0
    Safari: 12.0
  npmPackages:
    gatsby: ^1.9.277 => 1.9.278
    gatsby-image: ^2.0.13 => 2.0.13
    gatsby-link: ^1.6.46 => 1.6.46
    gatsby-plugin-react-helmet: ^1.0.8 => 1.0.8
    gatsby-plugin-sharp: ^2.0.5 => 2.0.5
    gatsby-source-contentful: ^1.3.54 => 1.3.54
    gatsby-source-filesystem: ^2.0.1 => 2.0.1
    gatsby-source-prismic: ^1.2.0 => 1.2.0
    gatsby-transformer-remark: ^1.7.44 => 1.7.44
    gatsby-transformer-sharp: ^2.1.3 => 2.1.3
  npmGlobalPackages:
    gatsby-cli: 2.4.2

I think the issue here is that you installed a version 2.x of gatsby-transformer-share but all the other gatsby libs are still on 1.x.

You should update the rest of the gatsby libs to be the latest of 2.x, you can follow the migration guide, otherwise if this is a test project following the tutorial I would delete the project and start again to be sure you get the latest versions of gatsby.

As it was a test project, I got it working restarting from _scratch_ with the most basic setup I could using gatsby-image and gatsby-transformer-sharp.

I put everything to 2.x (including gatsby itself) and up and it works like a charm. 馃憣

gatsby-source-prismic is still in 1.x but somehow still works. I should update it too probably.

Here is the ouput of gatsby info once more

[...]
  npmPackages:
    gatsby: ^2.0.0 => 2.0.17
    gatsby-image: ^2.0.13 => 2.0.13
    gatsby-plugin-manifest: ^2.0.2 => 2.0.4
    gatsby-plugin-offline: ^2.0.5 => 2.0.5
    gatsby-plugin-react-helmet: ^3.0.0 => 3.0.0
    gatsby-plugin-sharp: ^2.0.6 => 2.0.6
    gatsby-source-prismic: ^1.2.0 => 1.2.0
    gatsby-transformer-sharp: ^2.1.3 => 2.1.3
  npmGlobalPackages:
    gatsby-cli: 2.4.2

This was useful. Thanks @mikelax 馃樅 . Thanks @nicolasrouanne 馃樅. Thanks @anderskitson 馃樅

Was this page helpful?
0 / 5 - 0 ratings