Gatsby: Error: Cannot find module 'joi'

Created on 28 Jun 2019  Â·  19Comments  Â·  Source: gatsbyjs/gatsby

Description

Gatsby immediately throws an exception.

Steps to reproduce

gatsby

Expected result

Usage message, etc.

Actual result

C:\Users\_USER_\AppData\Roaming\npm\node_modules\gatsby-cli\node_modules\yoga-layout-prebuilt\yoga-layout\build\Release\nbind.js:53
        throw ex;
        ^

Error: Cannot find module 'joi'
    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> (C:\Users\johnp\AppData\Roaming\npm\node_modules\gatsby-cli\lib\structured-errors\construct-error.js:3:13)
    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

gatsby command doesn't work period.
npm version 6.9.2, i've tried uninstalling and reinstalling gatsby etc.

Most helpful comment

Published [email protected], please update and let us know in case it didn't do the trick

All 19 comments

Ditto on node 11.12:

/.nvm/versions/node/v11.12.0/lib/node_modules/gatsby-cli/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
        throw ex;
        ^

Error: Cannot find module 'joi'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:649:15)
    at Function.Module._load (internal/modules/cjs/loader.js:575:25)
    at Module.require (internal/modules/cjs/loader.js:705:19)
    at require (internal/modules/cjs/helpers.js:14:16)
    at Object.<anonymous> (/Users/foo/.nvm/versions/node/v11.12.0/lib/node_modules/gatsby-cli/lib/structured-errors/construct-error.js:3:13)
    at Module._compile (internal/modules/cjs/loader.js:799:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:810:10)
    at Module.load (internal/modules/cjs/loader.js:666:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:606:12)
    at Function.Module._load (internal/modules/cjs/loader.js:598:3)

Experiencing the same issue with node v12.3.1.

Just updated the cli .... it's broken:

.nvm/versions/node/v11.15.0/lib/node_modules/gatsby-cli/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
        throw ex;
        ^

Error: Cannot find module 'joi'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:668:15)

Node v11.15.0

/home/chun/.nvm/versions/node/v10.16.0/lib/node_modules/gatsby/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
throw ex;
^

Error: Cannot find module 'joi'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)

Hello folks!

We’re aware — thanks for letting us know, and sorry for this inconvenience!

The fix is in #15221, and will be published as soon as the unit tests pass.

Published [email protected], please update and let us know in case it didn't do the trick

Yay! Literally just experienced this, must have pulled right before you released. Thanks all!

Everything working 💯
node v11.3.0
npm 6.9.2
gatsby-cli 2.7.6
gatsby 2.11.3

Great, it works! I also had to update gatsby (not just the cli). Thanks!

Hi folks!

I updated every part, which was mentioned in the comments. Now I run on:

I'm on a Window 10 PC.

However, I get this error message whenever I type
gatsby develop

C:UsersLukas\AppData\Roamingnpmnode_modulesgatsby-clinode_modules\yoga-layout-prebuilt\yoga-layout\build\Release\nbind.js:53
throw ex;
^

Error: Cannot find module 'joi'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object. (C:UsersLukas\AppData\Roamingnpmnode_modulesgatsby-cli\lib\structured-errors\construct-error.js:3:13)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)

I fear, this is the same behaviour as before the update. What do I have to do to to get my Gatsby App up again?

@lukitroe can you run gatsby info in that project and post the output here?

Hello @KyleAMathews
Thank you much for your help!
Here is the output of gatsby info

C:\Users\Lukas\AppData\Roaming\npm\node_modules\gatsby-cli\node_modules\yoga-layout-prebuilt\yoga-layout\build\Release\nbind.js:53
        throw ex;
        ^

Error: Cannot find module 'joi'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:690:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (C:\Users\Lukas\AppData\Roaming\npm\node_modules\gatsby-cli\lib\structured-errors\construct-error.js:3:13)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)

Unfortunately it shows the same error! Is there a cache or something similar I can clear? My next steps would be to re-install everything. Do you think it is a good idea?

I appreciate your help!
Best regards,
lukitroe

Not sure — try running npm install -g gatsby-cli@latest?

Hi!

Thank you for your help, now gatsby info show this screen:

Captured event: { installedGatsbyVersion: '2.11.3',
  gatsbyCliVersion: '2.7.7',
  eventType: 'CLI_RAW_COMMAND_INFO',
  sessionId: 'e3104880-9aa4-11e9-b392-4d43792dbf4d',
  time: '2019-06-29T19:34:20.979Z',
  machineId: '9964ea30-7946-11e9-a3b6-e96800712326',
  repositoryId:
   'pwd:05d21fbb38c1a276185bf51b3fe2199ab75e9bfe2842344ed75222af9f247e4a',
  componentId: 'gatsby-cli',
  osInformation:
   { nodeVersion: 'v10.16.0',
     platform: 'win32',
     release: '10.0.17763',
     cpus: 'Intel(R) Core(TM) i7-3632QM CPU @ 2.20GHz',
     arch: 'x64',
     ci: false,
     docker: false },
  componentVersion: '1.1.2' }

  System:
    OS: Windows 10
    CPU: (8) x64 Intel(R) Core(TM) i7-3632QM CPU @ 2.20GHz
  Binaries:
    npm: 6.9.2 - C:\Program Files\nodejs\npm.CMD
  Languages:
    Python: 3.5.1
  Browsers:
    Edge: 44.17763.1.0
  npmPackages:
    gatsby: ^2.11.3 => 2.11.3
    gatsby-cli: ^2.7.6 => 2.7.6
    gatsby-image: ^2.1.0 => 2.1.0
    gatsby-link: ^1.6.46 => 1.6.46
    gatsby-plugin-catch-links: ^2.0.15 => 2.0.15
    gatsby-plugin-manifest: ^2.1.1 => 2.1.1
    gatsby-plugin-offline: ^2.1.1 => 2.1.1
    gatsby-plugin-react-helmet: ^3.0.12 => 3.0.12
    gatsby-plugin-sharp: ^2.1.5 => 2.1.5
    gatsby-remark-external-links: 0.0.4 => 0.0.4
    gatsby-remark-images: ^3.0.16 => 3.0.16
    gatsby-source-filesystem: ^2.0.37 => 2.0.37
    gatsby-transformer-remark: ^2.3.12 => 2.3.12
    gatsby-transformer-sharp: ^2.1.19 => 2.1.19

But, I'm still not able to run gatsby develop. Now there are several problems. One of them is this here
RangeError: Maximum call stack size exceeded

Hmmm... now I'm really confused. I'll investigate all my versions and packages, one error message was about core-js. Maybe updating core-js helps.
I'll give feedback if I got a solution or have more hints.

Progress!

Try deleting the lock file and node_modules directory and reinstalling.

On Sat, Jun 29, 2019, 12:55 PM lukitroe notifications@github.com wrote:

Hi!

Thank you for your help, now gatsby info show this screen:

Captured event: { installedGatsbyVersion: '2.11.3',
gatsbyCliVersion: '2.7.7',
eventType: 'CLI_RAW_COMMAND_INFO',
sessionId: 'e3104880-9aa4-11e9-b392-4d43792dbf4d',
time: '2019-06-29T19:34:20.979Z',
machineId: '9964ea30-7946-11e9-a3b6-e96800712326',
repositoryId:
'pwd:05d21fbb38c1a276185bf51b3fe2199ab75e9bfe2842344ed75222af9f247e4a',
componentId: 'gatsby-cli',
osInformation:
{ nodeVersion: 'v10.16.0',
platform: 'win32',
release: '10.0.17763',
cpus: 'Intel(R) Core(TM) i7-3632QM CPU @ 2.20GHz',
arch: 'x64',
ci: false,
docker: false },
componentVersion: '1.1.2' }

System:
OS: Windows 10
CPU: (8) x64 Intel(R) Core(TM) i7-3632QM CPU @ 2.20GHz
Binaries:
npm: 6.9.2 - C:\Program Files\nodejsnpm.CMD
Languages:
Python: 3.5.1
Browsers:
Edge: 44.17763.1.0
npmPackages:
gatsby: ^2.11.3 => 2.11.3
gatsby-cli: ^2.7.6 => 2.7.6
gatsby-image: ^2.1.0 => 2.1.0
gatsby-link: ^1.6.46 => 1.6.46
gatsby-plugin-catch-links: ^2.0.15 => 2.0.15
gatsby-plugin-manifest: ^2.1.1 => 2.1.1
gatsby-plugin-offline: ^2.1.1 => 2.1.1
gatsby-plugin-react-helmet: ^3.0.12 => 3.0.12
gatsby-plugin-sharp: ^2.1.5 => 2.1.5
gatsby-remark-external-links: 0.0.4 => 0.0.4
gatsby-remark-images: ^3.0.16 => 3.0.16
gatsby-source-filesystem: ^2.0.37 => 2.0.37
gatsby-transformer-remark: ^2.3.12 => 2.3.12
gatsby-transformer-sharp: ^2.1.19 => 2.1.19

But, I'm still not able to run gatsby develop. Now there are several
problems. One of them is this here
RangeError: Maximum call stack size exceeded

Hmmm... now I'm really confused. I'll investigate all my versions and
packages, one error message was about core-js. Maybe updating core-js helps.
I'll give feedback if I got a solution or have more hints.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/gatsbyjs/gatsby/issues/15220?email_source=notifications&email_token=AAARLB3LJPPV2U2IISQRUCLP4644VA5CNFSM4H4HMRP2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODY37FMQ#issuecomment-506983090,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAARLB4I2BB6F4IVIIF3OKDP4644VANCNFSM4H4HMRPQ
.

Hello @KyleAMathews

I think, my system is completly broken now. So I think, this ticket can be closed, cause it is no general error of Gatsby, but a problem of my setup. I constantyl ran into the same error. Maybe I switch to Docker Images and Containers, otherwise I have to redo all my work.

However, I really want to thank you for your help and your patience.
Best regards,
lukitroe

Hello!
Finally, I found a solution, I mean, @KyleAMathews wrote already the correct solution:

  1. delete nodes_moduls and lock file
  2. reinstall via npm install -g and afterwards npm install

Additionally, I executed gatsby clean.
AND, it seems, my main problem was a line with gatsby-link in my package.json file. Deleting this line, redo steps 1 and 2 did the trick. Please do not ask how this line got into package.json (I blame magic for that).

@KyleAMathews Once again: thank you very much!

Best regards,
lukitroe

Great!

On Sun, Jun 30, 2019, 9:14 AM lukitroe notifications@github.com wrote:

Hello!
Finally, I found a solution, I mean, @KyleAMathews
https://github.com/KyleAMathews wrote already the correct solution:

  1. delete nodes_moduls and lock file
  2. reinstall via npm install -g and afterwards npm install

Additionally, I executed gatsby clean.
AND, it seems, my main problem was a line with gatsby-link in my
package.json file. Deleting this line, redo steps 1 and 2 did the trick.
Please do not ask how this line got into package.json (I blame magic for
that).

@KyleAMathews https://github.com/KyleAMathews Once again: thank you
very much!

Best regards,
lukitroe

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/gatsbyjs/gatsby/issues/15220?email_source=notifications&email_token=AAARLB2TDHFYUSTYAD7NXKTP5DLVLA5CNFSM4H4HMRP2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODY4PE3Q#issuecomment-507048558,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAARLB4GFSP36UREAIWODJ3P5DLVLANCNFSM4H4HMRPQ
.

Thanks, It's work for me
Thanks @KyleAMathews

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Oppenheimer1 picture Oppenheimer1  Â·  3Comments

jimfilippou picture jimfilippou  Â·  3Comments

theduke picture theduke  Â·  3Comments

benstr picture benstr  Â·  3Comments

totsteps picture totsteps  Â·  3Comments