Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How To Fix Gatsby Develop Error: Cannot find module 'gatsby-cli/lib/reporter'?

Getting problem with Gatsby. It's is showing Error: Cannot find module 'gatsby-cli/lib/reporter' in command prompt when I am running gatsby develop . How can I solve it please answer.

Error Message

E:\JavaScript\gatsby-js> gatsby develop
success open and validate gatsby-configs - 0.008 s
error Error in "E:\JavaScript\gatsby-js\node_modules\gatsby-source-filesystem\gatsby-node.js":


  Error: Cannot find module 'gatsby-cli/lib/reporter'
  Require stack:
  - E:\JavaScript\gatsby-js\node_modules\gatsby-source-filesystem\utils.js
  - E:\JavaScript\gatsby-js\node_modules\gatsby-source-filesystem\create-file-node.js
  - E:\JavaScript\gatsby-js\node_modules\gatsby-source-filesystem\gatsby-node.js
  - E:\JavaScript\gatsby-js\node_modules\gatsby\dist\bootstrap\resolve-module-exports.js
  - E:\JavaScript\gatsby-js\node_modules\gatsby\dist\bootstrap\load-plugins\validate.js
  - E:\JavaScript\gatsby-js\node_modules\gatsby\dist\bootstrap\load-plugins\load.js
  - E:\JavaScript\gatsby-js\node_modules\gatsby\dist\bootstrap\load-plugins\index.js
  - E:\JavaScript\gatsby-js\node_modules\gatsby\dist\bootstrap\index.js
  - E:\JavaScript\gatsby-js\node_modules\gatsby\dist\commands\develop.js
  - C:\Users\Shayon\AppData\Roaming\npm\node_modules\gatsby-cli\lib\create-cli.js
  - C:\Users\Shayon\AppData\Roaming\npm\node_modules\gatsby-cli\lib\index.js

  - loader.js:623 Function.Module._resolveFilename
    internal/modules/cjs/loader.js:623:15

  - loader.js:527 Function.Module._load
    internal/modules/cjs/loader.js:527:27

  - loader.js:681 Module.require
    internal/modules/cjs/loader.js:681:19

  - v8-compile-cache.js:159 require
    [gatsby-js]/[v8-compile-cache]/v8-compile-cache.js:159:20

  - utils.js:15 Object.<anonymous>
    [gatsby-js]/[gatsby-source-filesystem]/utils.js:15:18

  - v8-compile-cache.js:178 Module._compile
    [gatsby-js]/[v8-compile-cache]/v8-compile-cache.js:178:30

  - loader.js:785 Object.Module._extensions..js
    internal/modules/cjs/loader.js:785:10

  - loader.js:641 Module.load
    internal/modules/cjs/loader.js:641:32

  - loader.js:556 Function.Module._load
    internal/modules/cjs/loader.js:556:12

  - loader.js:681 Module.require
    internal/modules/cjs/loader.js:681:19

  - v8-compile-cache.js:159 require
    [gatsby-js]/[v8-compile-cache]/v8-compile-cache.js:159:20

  - create-file-node.js:7 Object.<anonymous>
    [gatsby-js]/[gatsby-source-filesystem]/create-file-node.js:7:18

  - v8-compile-cache.js:178 Module._compile
    [gatsby-js]/[v8-compile-cache]/v8-compile-cache.js:178:30

  - loader.js:785 Object.Module._extensions..js
    internal/modules/cjs/loader.js:785:10

  - loader.js:641 Module.load
    internal/modules/cjs/loader.js:641:32

  - loader.js:556 Function.Module._load
    internal/modules/cjs/loader.js:556:12

  - loader.js:681 Module.require
    internal/modules/cjs/loader.js:681:19

  - v8-compile-cache.js:159 require
    [gatsby-js]/[v8-compile-cache]/v8-compile-cache.js:159:20

  - gatsby-node.js:12 Object.<anonymous>
    [gatsby-js]/[gatsby-source-filesystem]/gatsby-node.js:12:19

  - v8-compile-cache.js:178 Module._compile
    [gatsby-js]/[v8-compile-cache]/v8-compile-cache.js:178:30

  - loader.js:785 Object.Module._extensions..js
    internal/modules/cjs/loader.js:785:10

  - loader.js:641 Module.load
    internal/modules/cjs/loader.js:641:32


⠋ load plugins
like image 244
MD SHAYON Avatar asked Jun 18 '19 23:06

MD SHAYON


People also ask

How do I install node modules in Gatsby?

Type npm install -g gatsby-cli at a command line prompt to install the Gatsby command line interface or CLI. The -g flag installs Gatsby globally, which means that you can use it by typing gatsby at a prompt. For example, you can use gatsby new to create a new Gatsby site.

Do I need to install Gatsby globally?

You'll need to install Gatsby globally to use Gatsby CLI commands such as gatsby new . To do so, use npm install with the --global or -g flag. Once the installation completes, you can run gatsby new my-project to create a new Gatsby project.


1 Answers

I experienced the same issue as you. Install the missing module to your project with:

npm install --save gatsby-cli

Solution is from https://github.com/gatsbyjs/gatsby/issues/4131

like image 64
Benjamin C Avatar answered Oct 16 '22 03:10

Benjamin C