Gatsby: Cannot find module 'gatsby-cli/lib/reporter'

Created on 11 Aug 2020  ·  23Comments  ·  Source: gatsbyjs/gatsby

After updating from gatsby 2.24.36 to version 2.24.40 getting error on npm start:
Error in "/Users/Austin/Projects/schwayweb/node_modules/gatsby-plugin-page-creator/gatsby-node.js": Cannot find module 'gatsby-cli/lib/reporter'

entire output here: https://gist.github.com/theskillwithin/2482854d8aa23e91885799925516c833


  System:
    OS: macOS 10.15.6
    CPU: (12) x64 Intel(R) Xeon(R) CPU E5-1650 v2 @ 3.50GHz
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 12.14.1 - ~/.nvm/versions/node/v12.14.1/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.6 - ~/.nvm/versions/node/v12.14.1/bin/npm
  Languages:
    Python: 2.7.17 - /usr/local/bin/python
  Browsers:
    Chrome: 84.0.4147.105
    Firefox: 79.0
    Safari: 13.1.2
  npmPackages:
    gatsby: ^2.24.40 => 2.24.40 
    gatsby-background-image: ^1.1.1 => 1.1.1 
    gatsby-image: ^2.4.15 => 2.4.15 
    gatsby-plugin-emotion: ^4.3.10 => 4.3.10 
    gatsby-plugin-google-analytics: ^2.3.13 => 2.3.13 
    gatsby-plugin-layout: ^1.3.10 => 1.3.10 
    gatsby-plugin-manifest: ^2.4.22 => 2.4.22 
    gatsby-plugin-offline: ^3.2.23 => 3.2.23 
    gatsby-plugin-react-helmet: ^3.3.10 => 3.3.10 
    gatsby-plugin-root-import: ^2.0.5 => 2.0.5 
    gatsby-plugin-sharp: ^2.6.26 => 2.6.26 
    gatsby-source-contentful: ^2.3.36 => 2.3.36 
    gatsby-source-filesystem: ^2.3.24 => 2.3.24 
    gatsby-source-shopify: ^3.2.26 => 3.2.26 
    gatsby-transformer-remark: ^2.8.28 => 2.8.28 
    gatsby-transformer-sharp: ^2.5.12 => 2.5.12 
confirmed page creation bug

Most helpful comment

Fixed and published in [email protected] courtesy of @pvdz

All 23 comments

Installing gatsby-cli as a project dependency is a temporary workaround.

I can't duplicate this when I updated a site to 2.24.40 — but I'm also running an up-to-date version of gatsby-cli (2.12.81) — can you try upgrading gatsby-cli to the latest to see if that helps? Perhaps it's older global gatsby-cli versions not working w/ the latest gatsby for some reason.

Hello I have the same issue, when update to "gatsby": "^2.24.40", I also try to move back to "gatsby": "^2.24.37", but error still appears. I got the error on gatsby cloud

I can't duplicate this when I updated a site to 2.24.40 — but I'm also running an up-to-date version of gatsby-cli (2.12.81) — can you try upgrading gatsby-cli to the latest to see if that helps? Perhaps it's older global gatsby-cli versions not working w/ the latest gatsby for some reason.

I am also having this issue since updating. I am running gatsby-cli 2.12.82.

As mentioned by @sandren, installing gatsby-cli as a project dependency seems to help as a temporary measure.

In addition, the progress bar showing quantity of images being rendered, or queries being processed is no longer visible.

I don't have gatsby cli installed globally

Just tried porting a create react app to gatsby and I got this issue as well, using gatsby 2.24.40.

I'm seeing this on gatsby cloud itself... saw the same error on my local build and it was fixed by updating the CLI, but I can't control that on the cloud service.

Unfortunately I'm having the same issue when I try to gatsby develop in my project. I even did:

rm -rf node_modules package-lock.json
npm install
npm run clean
npm run develop

(With gatsby-cli installed globally).

OK - weird solution, but it might help others: removed package-lock.json and node_modules, then ran yarn install
Checked that into github and Gatsby Cloud built the site.

OK - weird solution, but it might help others: removed package-lock.json and node_modules, then ran yarn install
Checked that into github and Gatsby Cloud built the site.

When I run gatsby develop the following error shows up:

[blyatmobilebr@blyatmobilebr-pc coffee-shop]$ gatsby develop
Debugger listening on ws://127.0.0.1:9229/64580fc3-4d58-4652-9ae6-6648f2debd34
For help, see: https://nodejs.org/en/docs/inspector
success open and validate gatsby-configs - 0.125s

 ERROR 

Error in "/home/blyatmobilebr/Área de trabalho/coffee-shop/node_modules/gatsby-plugin-page-creator/gatsby-node.js": Cannot find module 'gatsby-cli/lib/reporter'
Require stack:
- /home/blyatmobilebr/Área de trabalho/coffee-shop/node_modules/gatsby-plugin-page-creator/is-valid-collection-path-implementation.js
- /home/blyatmobilebr/Área de trabalho/coffee-shop/node_modules/gatsby-plugin-page-creator/create-pages-from-collection-builder.js
- /home/blyatmobilebr/Área de trabalho/coffee-shop/node_modules/gatsby-plugin-page-creator/create-page-wrapper.js
- /home/blyatmobilebr/Área de trabalho/coffee-shop/node_modules/gatsby-plugin-page-creator/gatsby-node.js
- /home/blyatmobilebr/Área de trabalho/coffee-shop/node_modules/gatsby/dist/bootstrap/resolve-module-exports.js
- /home/blyatmobilebr/Área de trabalho/coffee-shop/node_modules/gatsby/dist/bootstrap/load-plugins/validate.js
- /home/blyatmobilebr/Área de trabalho/coffee-shop/node_modules/gatsby/dist/bootstrap/load-plugins/load.js
- /home/blyatmobilebr/Área de trabalho/coffee-shop/node_modules/gatsby/dist/bootstrap/load-plugins/index.js
- /home/blyatmobilebr/Área de trabalho/coffee-shop/node_modules/gatsby/dist/services/initialize.js
- /home/blyatmobilebr/Área de trabalho/coffee-shop/node_modules/gatsby/dist/services/index.js
- /home/blyatmobilebr/Área de trabalho/coffee-shop/node_modules/gatsby/dist/state-machines/develop/services.js
- /home/blyatmobilebr/Área de trabalho/coffee-shop/node_modules/gatsby/dist/state-machines/develop/index.js
- /home/blyatmobilebr/Área de trabalho/coffee-shop/node_modules/gatsby/dist/commands/develop-process.js
- /home/blyatmobilebr/Área de trabalho/coffee-shop/.cache/tmp-12398-m3KLIrnjoKyl



  Error: Cannot find module 'gatsby-cli/lib/reporter'
  Require stack:
  - /home/blyatmobilebr/Área de trabalho/coffee-shop/node_modules/gatsby-plugin-page-creator/is-valid-col  lection-path-implementation.js
  - /home/blyatmobilebr/Área de trabalho/coffee-shop/node_modules/gatsby-plugin-page-creator/create-pages  -from-collection-builder.js
  - /home/blyatmobilebr/Área de trabalho/coffee-shop/node_modules/gatsby-plugin-page-creator/create-page-  wrapper.js
  - /home/blyatmobilebr/Área de trabalho/coffee-shop/node_modules/gatsby-plugin-page-creator/gatsby-node.  js
  - /home/blyatmobilebr/Área de trabalho/coffee-shop/node_modules/gatsby/dist/bootstrap/resolve-module-ex  ports.js
  - /home/blyatmobilebr/Área de trabalho/coffee-shop/node_modules/gatsby/dist/bootstrap/load-plugins/vali  date.js
  - /home/blyatmobilebr/Área de trabalho/coffee-shop/node_modules/gatsby/dist/bootstrap/load-plugins/load  .js
  - /home/blyatmobilebr/Área de trabalho/coffee-shop/node_modules/gatsby/dist/bootstrap/load-plugins/inde  x.js
  - /home/blyatmobilebr/Área de trabalho/coffee-shop/node_modules/gatsby/dist/services/initialize.js
  - /home/blyatmobilebr/Área de trabalho/coffee-shop/node_modules/gatsby/dist/services/index.js
  - /home/blyatmobilebr/Área de trabalho/coffee-shop/node_modules/gatsby/dist/state-machines/develop/serv  ices.js
  - /home/blyatmobilebr/Área de trabalho/coffee-shop/node_modules/gatsby/dist/state-machines/develop/inde  x.js
  - /home/blyatmobilebr/Área de trabalho/coffee-shop/node_modules/gatsby/dist/commands/develop-process.js  - /home/blyatmobilebr/Área de trabalho/coffee-shop/.cache/tmp-12398-m3KLIrnjoKyl

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

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

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

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

  - is-valid-collection-path-implementation.js:10 Object.<anonymous>
    [coffee-shop]/[gatsby-plugin-page-creator]/is-valid-collection-path-implementation.js:10:40

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

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

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

  - loader.js:938 Function.Module._load
    internal/modules/cjs/loader.js:938:14

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

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

  - create-pages-from-collection-builder.js:28 Object.<anonymous>
    [coffee-shop]/[gatsby-plugin-page-creator]/create-pages-from-collection-builder.js:28:44

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

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

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

  - loader.js:938 Function.Module._load
    internal/modules/cjs/loader.js:938:14


not finished load plugins - 5.449s

npm i -D gatsby-cli fixed my Netlify deploy.

I assume I'll be able to remove this dependency once the underlying issue is resolved?

I am also experiencing this issue. I am able to work around by fixing the version:

npm install -D [email protected]

I am also experiencing this issue. I am able to work around by fixing the version:

npm install -D [email protected]

Looks like it actually still works without the version.

I was having this too. Adding gatsby-cli to my dev dependencies gets rid of the error, but even though develop no longer crashes and it's successfully executing my gatsby-node, it seems like it's hanging after that – I can never get to see anything in the browser.

Me too. Just happened on my Github actions. The previous deploy worked fine and suddenly, it no longer works.

~Pushing a fix in 5 now~

@pvdz pushed a fix, will publish once all is green

Fixed and published in [email protected] courtesy of @pvdz

For anyone who is still having problems getting this to work, especially on a new install, I had to delete the package-lock.json and then manually change the package.json entry for gatsby to ^2.24.42 from ^2.24.41 in order to get this fix.

I am trying to start my first project with Gatsby but I continue with the problem, I tried what you mention but I can not correct it.

I am trying to start my first project with Gatsby but I continue with the problem, I tried what you mention but I can not correct it.

Try npm i -g gatsby-cli first, then delete package-lock.json, modify package.json, then npm install to update it all. You probably did it correctly, but always good to give it another go. You can also try uninstalling gatsby first.

Before reporting to have this problem please make sure the proper gatsby version is installed

npm ls gatsby
└── [email protected]

yarn why gatsby
=> Found "[email protected]"

If that's not at least .42 then that's probably the reason. Thanks :)

Going to lock this because we're confident this particular issue has been fixed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hobochild picture hobochild  ·  3Comments

benstr picture benstr  ·  3Comments

Oppenheimer1 picture Oppenheimer1  ·  3Comments

kalinchernev picture kalinchernev  ·  3Comments

dustinhorton picture dustinhorton  ·  3Comments