Skip to content
FLAVIO COPES
flaviocopes.com
2026

Fix Gatsby 'cannot find module gatsby-cli/lib/reporter'

By Flavio Copes

Learn how to fix the Gatsby Cannot find module gatsby-cli/lib/reporter error by deleting node_modules and reinstalling with yarn instead of npm install.

~~~

I created a site using Gatsby and I ran gatsby develop to start a local server.

But a weird error showed up, coloring with red my terminal:

Gatsby error

After a few searches across GitHub and StackOverflow (I found a lot of people with the same problem!) and this is what fixed the error.

First, I deleted node_modules:

rm -rf node_modules

then I used yarn instead of npm install:

yarn

This installed all the packages again.

Finally I ran gatsby develop and it worked.

Terminal showing successful Gatsby development server startup with build process completing and localhost URLs displayed

Not sure what the cause problem is/was, but I tried again running npm install instead of yarn and it didn’t work.

~~~

Related posts about js: