Gatsby: Gatsby-cli module not found after updating to latest Gatsby verison

Created on 25 Mar 2020  路  12Comments  路  Source: gatsbyjs/gatsby

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.

Steps to reproduce

Update to latest Gatsby

Expected result

Gatsby-cli should be installed

Actual result

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. (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'
}

Environment

Same as above

bug

Most helpful comment

Painful. I can validate this is a node version issue. Upgraded to 13.12.0 and the problem is resolved.

All 12 comments

any solution?

any solution?

@kevb10 Reinstalled node js :)

Still seeing this issue. It happens when I run yarn develop. I tried reinstalling node. No dice.

node 13.0.1
yarn 1.22.4
gatsby 2.20.10
gatsby-cli 2.11.4

package.json:

{ "name": "gatsby-starter-default", "private": true, "description": "A simple starter to get up and developing quickly with Gatsby", "version": "0.1.0", "author": "Kyle Mathews <[email protected]>", "dependencies": { "gatsby": "^2.19.45", "gatsby-image": "^2.2.44", "gatsby-plugin-manifest": "^2.2.48", "gatsby-plugin-offline": "^3.0.41", "gatsby-plugin-react-helmet": "^3.1.24", "gatsby-plugin-sharp": "^2.4.13", "gatsby-source-filesystem": "^2.1.56", "gatsby-transformer-sharp": "^2.3.19", "prop-types": "^15.7.2", "react": "^16.13.1", "react-dom": "^16.13.1", "react-helmet": "^5.2.1" }, "devDependencies": { "prettier": "^1.19.1" }, "keywords": [ "gatsby" ], "license": "MIT", "scripts": { "build": "gatsby build", "develop": "gatsby develop", "format": "prettier --write \"**/*.{js,jsx,json,md}\"", "start": "npm run develop", "serve": "gatsby serve", "clean": "gatsby clean", "test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1" }, "repository": { "type": "git", "url": "https://github.com/gatsbyjs/gatsby-starter-default" }, "bugs": { "url": "https://github.com/gatsbyjs/gatsby/issues" } }

Painful. I can validate this is a node version issue. Upgraded to 13.12.0 and the problem is resolved.

this is still not resolved

Screenshot (42)
update node still not working

I have the same issue. I opened one of the duplicates above. I have an example repository here where at least I can reproduce the bug: https://github.com/ehannes/broken-gatsby-develop-command.

I have the latest version of gatsby, gatsby-cli and node:

  System:
    OS: Linux 5.3 Pop!_OS 18.04 LTS
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Shell: 4.4.20 - /bin/bash
  Languages:
    Python: 2.7.17 - /usr/bin/python
  Browsers:
    Chrome: 81.0.4044.129
    Firefox: 75.0
  npmPackages:
    gatsby: ^2.22.0 => 2.22.11
$ node --version
v10.20.1
gatsby --version
Gatsby CLI version: 2.12.36

Temporarily downgrading to gatsby 2.21.40 to being able to build.

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

installed the latest version of node (14.3.0) and apparently works.

same as @d0x1n . Upgraded to the latest node version works for me.

Upgrading to latest node did not work for me. I already reverted to the previous gatsby version too.
Removing package-lock.json and running npm install again fixed it.

I am also having this issue.

gatsby 2.24.54
node 14.9.0

Not sure if this is relevant but I am working on a Wordpress Jamstack build, my other dependencies are:

    "gatsby-plugin-sharp": "^2.6.31",
    "gatsby-source-wordpress-experimental": "^1.3.8",
    "gatsby-transformer-sharp": "^2.5.14",
    "react": "^16.12.0",
    "react-dom": "^16.12.0"

I was previously running gatsby 2.24.50 and I was still having this issue (with node at the above mentioned version).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kalinchernev picture kalinchernev  路  3Comments

signalwerk picture signalwerk  路  3Comments

ghost picture ghost  路  3Comments

timbrandin picture timbrandin  路  3Comments

magicly picture magicly  路  3Comments