Colin Sygiel
Colin Sygiel

Reputation: 945

Why does a fresh gatsby install return a module not found error?

Description

It all started after I updated Gatsby to the latest version in my project that I would receive an error saying the Gatsby-cli module could not be found (error written below) after running gatsby develop After a lot of troubleshooting, I tried creating a new gatsby site with a fresh install of npm install -g gatsby-cli and npm install -g gatsby, but I was getting the same error. Even after running gatsby -v I get the same error. It doesn't seem to be installing gastby?

Error Message

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

Error: Package exports for 'C:\Users\ctsyg\AppData\Roaming\npm\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.<anonymous> (C:\Users\ctsyg\AppData\Roaming\npm\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'
}

Upvotes: 1

Views: 549

Answers (1)

Colin Sygiel
Colin Sygiel

Reputation: 945

Fixed: I had to reinstall node.js for some reason.

Upvotes: 1

Related Questions