Error: Cannot find module 'gatsby-cli/lib/reporter'
See original GitHub issueDescription
When trying to do gatsby build
, I’m noticing that my custom source plugins as well as Gatsby packages are trying to find gatsby-cli/lib/reporter
, so every build fails with something that looks like this:
error Error in "/Users/jaredsilver/projects/marketing-app/node_modules/gatsby-plugin-sharp/gatsby-node.js":
Error: Cannot find module 'gatsby-cli/lib/reporter'
Require stack:
- /Users/jaredsilver/projects/marketing-app/node_modules/gatsby-plugin-sharp/utils.js
- /Users/jaredsilver/projects/marketing-app/node_modules/gatsby-plugin-sharp/scheduler.js
- /Users/jaredsilver/projects/marketing-app/node_modules/gatsby-plugin-sharp/index.js
- /Users/jaredsilver/projects/marketing-app/node_modules/gatsby-plugin-sharp/gatsby-node.js
- /Users/jaredsilver/projects/marketing-app/node_modules/gatsby/dist/bootstrap/resolve-module-exports.js
- /Users/jaredsilver/projects/marketing-app/node_modules/gatsby/dist/bootstrap/load-plugins/validate.js
- /Users/jaredsilver/projects/marketing-app/node_modules/gatsby/dist/bootstrap/load-plugins/load.js
- /Users/jaredsilver/projects/marketing-app/node_modules/gatsby/dist/bootstrap/load-plugins/index.js
- /Users/jaredsilver/projects/marketing-app/node_modules/gatsby/dist/bootstrap/index.js
- /Users/jaredsilver/projects/marketing-app/node_modules/gatsby/dist/commands/build.js
- /Users/jaredsilver/.nvm/versions/node/v12.2.0/lib/node_modules/gatsby-cli/lib/create-cli.js
- /Users/jaredsilver/.nvm/versions/node/v12.2.0/lib/node_modules/gatsby-cli/lib/index.js
Environment
I’ve tried a few different versions of gatsby, gatsby-cli, and where gatsby-cli lives, but this is one example:
System:
OS: macOS High Sierra 10.13.3
CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.2.0 - ~/.nvm/versions/node/v12.2.0/bin/node
Yarn: 1.10.1 - /usr/local/bin/yarn
npm: 6.9.0 - ~/.nvm/versions/node/v12.2.0/bin/npm
Languages:
Python: 2.7.10 - /usr/bin/python
Browsers:
Chrome: 74.0.3729.169
Firefox: 59.0.2
Safari: 11.0.3
npmPackages:
gatsby: ^2.9.4 => 2.9.6
gatsby-image: ^2.1.4 => 2.1.4
gatsby-plugin-emotion: ^4.0.6 => 4.0.7
gatsby-plugin-portal: ^1.0.7 => 1.0.7
gatsby-plugin-purgecss: ^4.0.0 => 4.0.0
gatsby-plugin-react-helmet: ^3.0.12 => 3.0.12
gatsby-plugin-react-svg: ^2.1.1 => 2.1.1
gatsby-plugin-sass: ^2.0.11 => 2.0.11
gatsby-plugin-sentry: ^1.0.1 => 1.0.1
gatsby-plugin-sharp: ^2.1.5 => 2.1.6
gatsby-source-apiserver: ^2.1.2 => 2.1.2
gatsby-source-filesystem: ^2.0.39 => 2.0.40
gatsby-source-graphql: ^2.0.19 => 2.0.19
gatsby-transformer-sharp: ^2.1.21 => 2.1.21
gatsby-transformer-yaml: ^2.1.12 => 2.1.12
npmGlobalPackages:
gatsby-cli: 2.6.9
Issue Analytics
- State:
- Created 4 years ago
- Reactions:7
- Comments:50 (18 by maintainers)
Top Results From Across the Web
Cannot find module 'gatsby-cli/lib/reporter'? - Stack Overflow
Getting problem with Gatsby. It's is showing Error: Cannot find module 'gatsby-cli/lib/reporter' in command prompt when I am running gatsby ...
Read more >Gatsby, fix the "cannot find module gatsby-cli/lib/reporter" error
I created a site using Gatsby and I ran gatsby develop to start a local server. After a few searches across GitHub and...
Read more >Cannot find module 'gatsby-cli/lib/reporter' #26345 - GitHub
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...
Read more >I just updated to gatsby-plugin image and made some ...
I just updated to gatsby-plugin image and made some necessary package upgrades with gatsbyjs and have no issues locally but Netlify is ...
Read more >Gatsby - Fork My Brain
This error occurs when plugins are being used that have not been installed. To remedy this, do an npm install -g . This...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
we rolled back the change for now so the latest npm packages shouldn’t have this issue. We’ll reiterate on the reporter-npm fix and ship it somewhere this week.
Thanks for sticking with us and helping us debug this issue! ❤️ Sorry for the inconveniences it may have caused.
This is caused by https://github.com/gatsbyjs/gatsby/commit/967597c12fc5d227de4c1767bf82bc751f2fe0d0
gatsby-plugin-sharp
:src/utils.js
gatsby-source-filesystem
:src/utils.js
Because of
require(`gatsby-cli/lib/reporter`)
This error doesn’t occur for
yarn
becauseyarn
flattens thenode_modules
tree. So,gatsby-cli
is available at./node_modules/gatsby-cli
. Withnpm
it’s./node_modules/gatsby/node_modules/gatsby-cli
.It works after
npm install gatsby-cli --save-dev
because, it addsgatsby-cli
at top level:./node_modules/gatsby-cli
@wardpeet @DanielRuf