Gatsby: Gatsby-cli not working

Created on 28 Oct 2019  ·  21Comments  ·  Source: gatsbyjs/gatsby

Getting the following error since updating to [email protected]

➜ 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'
  ]
}

confirmed bug

Most helpful comment

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.

All 21 comments

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.

I was just about to post the same thing. Experiencing this on Mojave. Can verify that [email protected] installs without a problem.

Also just ran into this same error after running this update Update available 2.8.2 → 2.8.6 -- also running on Ubuntu.

Edit: can confim that npm install -g gatsby as per @RaulCote seems to solve, but this is definitely the first time I've ever had to install Gatsby itself globally.

Yep, facing the same issue.

Error: Cannot find module 'gatsby-core-utils'

@RaulCote Does running npm i -g gatsby solve the issue?

Node: 10.16.3

Yep, facing the same issue.

Error: Cannot find module 'gatsby-core-utils'

@RaulCote Does running npm i -g gatsby solve the issue?

Node: 10.16.3

To me it did the trick.

I was doing a fresh install and got the same error.

npm i -g gatsby fixed it for me!

So is this a bug or the solution is to use only npm i -g gatsby?

npm i -g gatsby and yarn global add gatsby-cli didn't solve it for me, there must be a bug, i tried it with node 8, 10 and 12

I am having the same issue on WSL. npm i -g gatsby is not working for me either. I have updated Gatsby, npm, and node. Glad I am not the only one having this problem.

same issue too.. i get similar message when I install using npm install --global gatsby-cli and try to run gatsby --help

same issue too.. i get similar message when I install using npm install --global gatsby-cli and try to run gatsby --help

I uninstalled gatsby-cli and used npm install --global gatsby as others have recommended; it works with error messages about "unmet peer dependencies" but it works..

Apologies for this, just published a fix in [email protected]

Please test and close this 🙂

Thank you @sidharthachatterjee for getting this fixed so quickly, closing.

Thanks 🐱‍💻

I have the same issue .
when I installed it told me "[email protected]" looks like nothing error, but when I tried check version it shows like below:

gatsby --version

`/usr/local/lib/node_modules/gatsby-cli/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
throw ex;
^

Error: Package exports for '/usr/local/lib/node_modules/gatsby-cli/node_modules/clipboardy' do not define a '.' subpath
at resolveExports (internal/modules/cjs/loader.js:419:17)
at Function.Module._findPath (internal/modules/cjs/loader.js:492:20)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:787:27)
at Function.Module._load (internal/modules/cjs/loader.js:693:27)
at Module.require (internal/modules/cjs/loader.js:864:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object. (/usr/local/lib/node_modules/gatsby-cli/lib/create-cli.js:24:20)
at Module._compile (internal/modules/cjs/loader.js:971:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1011:10)
at Module.load (internal/modules/cjs/loader.js:822:32) {
code: 'MODULE_NOT_FOUND'
}`

FYI, I am getting the same error. Ultimately, after installing an older version, it worked. My installation command that produced a working CLI...

npm install -g [email protected]

Downgrading gatsby version did not help. Then I updated my node version to the latest and it started working.

@sidharthachatterjee Unfortunately this is still a problem.

I'm on a new machine running WSL, latest Node LTS via NVM (v12.18.1), and latest Gatsby CLI (2.12.52).

Tried globally installing the cli via latest npm and yarn. (Project uses yarn.)

Works fine on my mac but throws the same error listed in WSL:

internal/modules/cjs/loader.js:969
  throw err;
  ^

Error: Cannot find module 'gatsby-cli'
Require stack:
- /mnt/c/projects/jel011/node_modules/gatsby/dist/bin/gatsby.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
    at Function.Module._load (internal/modules/cjs/loader.js:842:27)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/mnt/c/projects/jel011/node_modules/gatsby/dist/bin/gatsby.js:4:1)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/mnt/c/projects/jel011/node_modules/gatsby/dist/bin/gatsby.js' ]
}
error Command failed with exit code 1.

Actually when I look at it, this is a slightly different error, but the cli isn't loading either way.

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:

Actually when I look at it, this is a slightly different error, but the
cli isn't loading either way.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/gatsbyjs/gatsby/issues/19088#issuecomment-652119644,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAAF6GOPJN3EZGCZNTK4SJ3RZKARXANCNFSM4JF6E4SA
.

I have the same issue .
when I installed it told me "[email protected]" looks like nothing error, but when I tried check version it shows like below:

gatsby --version

`/usr/local/lib/node_modules/gatsby-cli/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
throw ex;
^

Error: Package exports for '/usr/local/lib/node_modules/gatsby-cli/node_modules/clipboardy' do not define a '.' subpath
at resolveExports (internal/modules/cjs/loader.js:419:17)
at Function.Module._findPath (internal/modules/cjs/loader.js:492:20)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:787:27)
at Function.Module._load (internal/modules/cjs/loader.js:693:27)
at Module.require (internal/modules/cjs/loader.js:864:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object. (/usr/local/lib/node_modules/gatsby-cli/lib/create-cli.js:24:20)
at Module._compile (internal/modules/cjs/loader.js:971:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1011:10)
at Module.load (internal/modules/cjs/loader.js:822:32) {
code: 'MODULE_NOT_FOUND'
}`

I was getting this error and upgrading my node version fixed it. I think I was on node 13.9, now I'm on 14.5.0.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

3CordGuy picture 3CordGuy  ·  3Comments

hobochild picture hobochild  ·  3Comments

theduke picture theduke  ·  3Comments

magicly picture magicly  ·  3Comments

brandonmp picture brandonmp  ·  3Comments