May 10, 2020 • ☕️ 1 min read
日本語

Table Of Contents

After upgrade gatsby from 2.15.14 → 2.21.21, running gatsby develop throws strange exception.

Copy
 ERROR 

There was a problem loading the local develop command. Gatsby may not be installed. Perhaps you need to run "npm install"? Cannot find module './lib'



  Error: Cannot find module './lib'

To find out the reason, I cost a bunch of time to upgrade all packages one by one. And the error occurred only after upgrade gatsby.

The most strange thing is that even after downgrade gatsby to the version before, the error didn’t disappear. I googled and searched the error report in gatsby’s github, but got nothing.

But finally I found that after downgrade gatsby, if I delete node_modules and re-install all things again. The system ran normally.

Yes! That’s the solution

After upgrade all packages including gatsby, delete node_modules and re-install all packages should solve the problem.

Copy
yarn upgrade --latest
rm -rf node_modules
yarn

Relative Posts

Spam filter for Netlify form in Gatsby

June 18, 2020

Auto-load all stories in storybook by storybook-loader

February 26, 2019

ThunderMiracle

Blog part of ThunderMiracle.com