When I create a new app and run it I get the error Error: Cannot find module 'gatsby-cli/lib/reporter’
I believe the version of gatsby needs to be upgraded, per this issue:
https://github.com/gatsbyjs/gatsby/issues/26345
The application is currently being generated with version 2.24.41, rather than 2.24.42
npx gatsby new app
cd app
npm install
nom run start
App should start
Received the error: Error: Cannot find module 'gatsby-cli/lib/reporter’
System:
OS: macOS Mojave 10.14.6
CPU: (4) x64 Intel(R) Core(TM) i5-4260U CPU @ 1.40GHz
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.17.0 - ~/.nvm/versions/node/v10.17.0/bin/node
Yarn: 1.12.3 - /usr/local/bin/yarn
npm: 6.11.3 - ~/.nvm/versions/node/v10.17.0/bin/npm
Languages:
Python: 2.7.16 - /usr/bin/python
Browsers:
Chrome: 84.0.4147.125
Firefox: 79.0
Safari: 13.1.2
npmPackages:
gatsby: ^2.24.41 => 2.24.41
gatsby-image: ^2.4.15 => 2.4.15
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-sharp: ^2.6.26 => 2.6.26
gatsby-source-filesystem: ^2.3.24 => 2.3.24
gatsby-transformer-sharp: ^2.5.12 => 2.5.12
I just encountered this.
I have the same issue for 3-4 days now after an update of the CLI. I cannot even go through the docs with trying out things, luckily I am pretty familiar with the general working of React and it's alright to not code along. It's hindering since this is related to my job application.
I opened an issue as well, but apparently someone completely deleted it.
Hello,
That issue already occurred in the past: https://github.com/gatsbyjs/gatsby/issues/14875
I just faced it again and made it works by installing the gatsby-cli locally.
npm install gatsby-cli --save-dev
Running npx gatsby-cli project-name neither gives proper result. Practically no package should be installed globally anymore, but if there is one, it's a CLI. I don't install typescript globally anymore either.
You are also correct, I tried installing the CLI locally in a folder then creating a project started from there and it works then. Really weird if this already happened before, thanks for pointing it out!
Well, I also made it working by making a npm update.
@PulseAD Thanks for that tip, this seems to be the best workaround when using npx in my case as well. Either that or we can just create an entire directory dedicated to Gatsby with the CLI installed locally there and continue forth using that local package.
EDIT: This issue is somehow resolved now and I do not require and workarounds mentioned before.
This problem appears to now be fixed. Creating a project with npx gatsby new my-app now generates a project with gatsby version 2.24.47 which avoids the library issue.
Most helpful comment
Well, I also made it working by making a npm update.