gatsby: gatsby-cli broken after upgrade: Error: Cannot find module './create-cli'
Description
Gatsby CLI not working after upgrade.
Steps to reproduce
npm i -g gatsby-cli
Expected result
gatsby-cli should work normally after upgrade
Actual result
Error: Cannot find module './create-cli'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/local/lib/node_modules/gatsby-cli/lib/index.js:70:19)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
Environment
Run gatsby info --clipboard in your project directory and paste the output here. Not working? You may need to update your global gatsby-cli - npm install -g gatsby-cli
gatsby info --clipboard does not work now. Unable to run gatsby-cli.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 27 (8 by maintainers)
Quick followup. The only thing that fixed this issue for me was reinstalling node.js entirely. After that I reinstalled gatsby-cli and everything started working again. @sidharthachatterjee I did this before seeing your message. Not sure if that output would reflect the state it was in while the error was happening as it’s fixed now.
@irenedemas if you don’t mind i would like for you to do one thing. As you’re using npm
What this will do is purge the global npm cache. Install gatsby cli again using the following command
sudo npm install -g gatsby-cliassuming you are running ubuntu, if not adjust for your setup.My reasoning behind this, because on a old machine i had laying around, this issue popped up and no matter how many ways i went about it, the result was the same you’re experiencing, which is according to a bit of investigation, npm was going for the cached version and not for the remote version and if the cached version had some issues, then it would propagate it.
Feel free to provide feedback
@DSchau I am really sorry for the delay in answering. Now when I use a new starter (e.g. ueno’s) everything works but when I try to gatsby develop my previous project I get this error:
Any ideas on how to fix it or where I should look?
Thank you and sorry again.
I have the exact same problem:
running
yarn devresults in:Running
npx gatsby info --clipboardresults in:Cannot find module 'gatsby-cli.I have repeatedly:
I am using:
I am badly struck as none of my gatsby projects run anymore 😦