gatsby: Gatsby-cli not working
Getting the following error since updating to gatsby-cli@2.8.6
➜ gatsby clean
/usr/local/lib/node_modules/gatsby-cli/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
throw ex;
^
Error: Cannot find module 'gatsby-core-utils'
Require stack:
- /usr/local/lib/node_modules/gatsby-cli/lib/reporter/errors.js
- /usr/local/lib/node_modules/gatsby-cli/lib/reporter/index.js
- /usr/local/lib/node_modules/gatsby-cli/lib/create-cli.js
- /usr/local/lib/node_modules/gatsby-cli/lib/index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:794:15)
at Function.Module._load (internal/modules/cjs/loader.js:687:27)
at Module.require (internal/modules/cjs/loader.js:849:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/usr/local/lib/node_modules/gatsby-cli/lib/reporter/errors.js:13:18)
at Module._compile (internal/modules/cjs/loader.js:956:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
at Module.load (internal/modules/cjs/loader.js:812:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Module.require (internal/modules/cjs/loader.js:849:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/usr/local/lib/node_modules/gatsby-cli/lib/reporter/errors.js',
'/usr/local/lib/node_modules/gatsby-cli/lib/reporter/index.js',
'/usr/local/lib/node_modules/gatsby-cli/lib/create-cli.js',
'/usr/local/lib/node_modules/gatsby-cli/lib/index.js'
]
}
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 7
- Comments: 33 (3 by maintainers)
I’m still having this issue on Windows using:
node version 14.17.6 (the latest LTS version) gatsby-cli (installed globally) version 3.13.0 (the latest version)
To Reproduce
cmdon yourDesktopdirectorygatsby new gatsby-bugto start the new Gatsby project.cd gatsby-bugandgatsby developto try to start the development server.This gives me the following error:
I also tried creating the project folder first, then running
gatsby new .inside of it, which gave similar results.What Did Work
cmdand execute the commandgatsby new(without any arguments) in the parent directory of where you want your new Gatsby project (for example, executegatsby newon yourDesktopdirectory if you want it to live inDesktop\my-gatsby-site\).cd my-gatsby-siteand thengatsby develop. The server should run without any issues.Final Thoughts
I’ve found this work-around, but I think this issue should be re-opened since I’m not the only one having this problem.
It’s very interesting that @lorensr fixed this problem by updating to
node@14, @kubarbaz fixed it by changing from Latest Version to LTS, and I’m having the issue with LTS. Maybe the act of simply re-installing Node is what did it? I don’t really feel like re-installing Node to find out.I also didn’t try installing gatsby globally with
npm install -g gatsby. It just feels kind of hacky. What if your project’s Gatsby version is different than the globally installed version? Couldn’t that cause problems?I was having the same problem today, just installed node 12 on ubuntu (mate) 19.10 and run to install gatsby-cli. I think that usually I only install gatsby-cli, but this time I had to install also gatsby ( npm install -g gatsby ) and everything began to work.
To me it did the trick.
Still happens for me as well. Running
npm i gatsby-core-utilsfixed it.I had the
Cannot find module 'gatsby-core-utils'error coming from./node_modules/yoga-layout-prebuiltwithgatsby@2.32.8andnode@12. Switching tonode@14removed the error.Thank you @sidharthachatterjee for getting this fixed so quickly, closing.
Apologies for this, just published a fix in
gatsby-cli@2.8.7Please test and close this 🙂
Yesterday I have installed
nodejs 14.17.6 LTSthennpm install -g gatsby-cliafter that I created a new projectgatsby new my-appall was installed with no errors, then I went into the foldercd my-appand tried to start the local servergatsby develop, and voila: `…/Desktop/my-app/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53 throw ex; ^Error: Cannot find module ‘gatsby-core-utils’`
I tried all the above options nothing helped.
OS: macOS BigSur 11.5.2 Gatsby CLI version: 3.13.0 Gatsby version: 3.13.0
Follow up: after another full clean install of the repo and cli it is working. Not sure what the issue was.
On Tue, Jun 30, 2020 at 5:38 PM moses gunesch notifications@github.com wrote:
Thanks 🐱💻
Yep, facing the same issue.
Error: Cannot find module 'gatsby-core-utils'@RaulCote Does running
npm i -g gatsbysolve the issue?Node: 10.16.3