gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.27k stars 10.31k forks source link

(gatsby-cli): Cannot find module 'react' #26919

Closed jlguenego closed 4 years ago

jlguenego commented 4 years ago

Try to start tutorial with Gatsby.

Description

D:\formation>gatsby
C:\Users\jlouis.JLG.000\AppData\Roaming\npm\node_modules\gatsby\node_modules\yoga-layout-prebuilt\yoga-layout\build\Release\nbind.js:53
        throw ex;
        ^

Error: Cannot find module 'react'
Require stack:
- C:\Users\jlouis.JLG.000\AppData\Roaming\npm\node_modules\gatsby\node_modules\gatsby-recipes\dist\index.js
- C:\Users\jlouis.JLG.000\AppData\Roaming\npm\node_modules\gatsby\node_modules\gatsby-cli\lib\recipes.js
- C:\Users\jlouis.JLG.000\AppData\Roaming\npm\node_modules\gatsby\node_modules\gatsby-cli\lib\create-cli.js
- C:\Users\jlouis.JLG.000\AppData\Roaming\npm\node_modules\gatsby\node_modules\gatsby-cli\lib\index.js
- C:\Users\jlouis.JLG.000\AppData\Roaming\npm\node_modules\gatsby\dist\bin\gatsby.js
- C:\Users\jlouis.JLG.000\AppData\Roaming\npm\node_modules\gatsby\cli.js

Steps to reproduce

Remove nodeJS from my Windows 10 computer:

Install nodejs v14.11.0 with all defaulted options.

Then

npm i -g gatsby
gatsby

Expected result

According the doc, I see a help screen...

Actual result

...But in fact, I get an error stack trace as described above.

Environment

Run gatsby info --clipboard in your project directory and paste the output here. Sorry I cannot, I get the error stacktrace.

pieh commented 4 years ago

Sorry about that - I just opened pull request that reverts the change that caused this ( https://github.com/gatsbyjs/gatsby/pull/26921 )

pieh commented 4 years ago

As a workaround until fix gets merged and published - please do npm install -g gatsby-cli@2.12.97 to use 1 version before the problem

Isaac-Tait commented 4 years ago

Thank you for the information. I was having similar issues with gatsby clean throwing errors

        throw ex;
        ^

Error: Cannot find module 'react'
Require stack:
- /usr/local/lib/node_modules/gatsby-cli/node_modules/gatsby-recipes/dist/index.js
- /usr/local/lib/node_modules/gatsby-cli/lib/recipes.js
- /usr/local/lib/node_modules/gatsby-cli/lib/create-cli.js
- /usr/local/lib/node_modules/gatsby-cli/lib/index.js
- /usr/local/lib/node_modules/gatsby-cli/cli.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:892:15)
    at Function.Module._load (internal/modules/cjs/loader.js:742:27)
    at Module.require (internal/modules/cjs/loader.js:964:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/gatsby-cli/node_modules/gatsby-recipes/dist/index.js:7:15)
    at Module._compile (internal/modules/cjs/loader.js:1075:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1096:10)
    at Module.load (internal/modules/cjs/loader.js:940:32)
    at Function.Module._load (internal/modules/cjs/loader.js:781:14)
    at Module.require (internal/modules/cjs/loader.js:964:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/usr/local/lib/node_modules/gatsby-cli/node_modules/gatsby-recipes/dist/index.js',
    '/usr/local/lib/node_modules/gatsby-cli/lib/recipes.js',
    '/usr/local/lib/node_modules/gatsby-cli/lib/create-cli.js',
    '/usr/local/lib/node_modules/gatsby-cli/lib/index.js',
    '/usr/local/lib/node_modules/gatsby-cli/cli.js'
  ]
}
pieh commented 4 years ago

I'm publishing right now - will post another comment when it actually gets published on npm

pieh commented 4 years ago

Published gatsby-cli@2.12.99 which is pretty much the same as gatsby-cli@2.12.97

MrDeLeTeD commented 4 years ago

Thanks for the QuickFix. Is it possible to add CIT to the pipeline to be sure that the release still working ?