gatsby: [gatsby-cli] Error: Cannot find module '../ink/components/progress-bar'

Description

After updating “gatsby-cli”: “^2.10.3”, it throws the following error.

Error: Cannot find module '../ink/components/progress-bar'

Steps to reproduce

Update gatsby-cli to ^2.10.3 and run gatsby develop or any other gatsby ... command

Expected result

Gatsby CLI should run every gatsby ... command as usual instead of breaking.

Actual result

▶ gatsby develop
/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 '../ink/components/progress-bar'
Require stack:
- /usr/local/lib/node_modules/gatsby-cli/lib/reporter/loggers/ink/cli.js
- /usr/local/lib/node_modules/gatsby-cli/lib/reporter/loggers/ink/index.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/loggers/ink/cli.js:22:20)
    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/loggers/ink/cli.js',
    '/usr/local/lib/node_modules/gatsby-cli/lib/reporter/loggers/ink/index.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'
  ]
}

Environment

Unfortunately gatsby info --clipboard doesn’t work either.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 51
  • Comments: 46 (7 by maintainers)

Commits related to this issue

Most upvoted comments

I’ve identified this and have a hotfix coming. No worries @herecydev, but thank you!

OOF! So sorry about this everyone… I’ve released a new version that fixes this. Please update.

Again, I’m so sorry for the damage this caused in lost time and hair-pulling! 😢 💜

@mmafe please make sure that gatsby and gatsby-cli in package.json as following "gatsby": "^2.19.34", "gatsby-cli": "^2.10.4",

@blainekasten Sorry! Can we reopen this issue? I’m still receiving the same error (similar to @danoszz) with the gatsby 2.19.34 and gatsby-cli 2.10.4. 😃

@abdokouta The fix has been merged, if I was a betting man I would say a release would be available imminently

@mmafe please make sure that gatsby and gatsby-cli in package.json as following "gatsby": "^2.19.34", "gatsby-cli": "^2.10.4",

Adding gatsby-cli to my package.json fixed my netlify build, thanks!

After running npm update gatsby. It fixed the netlify problem for me and built correctly

After 4.5 hours of debugging, I’m thrilled that this thread is the thing that finally helped me fix my failing Netlify deploy. I fixed it by updating Gatsby npm update gatsby on local, then pushing the update.

hm, strange

cstamas@Albert ~/Worx/aura/www01  (master *)$ npm i -g gatsby-cli@2.8.29
npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
/home/linuxbrew/.linuxbrew/bin/gatsby -> /home/linuxbrew/.linuxbrew/lib/node_modules/gatsby-cli/lib/index.js

> gatsby-cli@2.8.29 postinstall /home/linuxbrew/.linuxbrew/lib/node_modules/gatsby-cli
> node scripts/postinstall.js

Success!

Welcome to the Gatsby CLI! Please visit https://www.gatsbyjs.org/docs/gatsby-cli/ for more information.

Usage: gatsby <command> [options]

Commands:
  gatsby develop                   Start development server. Watches files, rebuilds, and hot reloads if something changes
  gatsby build                     Build a Gatsby project.
  gatsby serve                     Serve previously built Gatsby site.
  gatsby info                      Get environment information for debugging and issue reporting
  gatsby clean                     Wipe the local gatsby environment including built assets and cache
  gatsby repl                      Get a node repl with context of Gatsby environment, see (https://www.gatsbyjs.org/docs/gatsby-repl/)
  gatsby new [rootPath] [starter]  Create new Gatsby project.
  gatsby plugin                    Useful commands relating to Gatsby plugins
  gatsby telemetry                 Enable or disable Gatsby anonymous analytics collection.

Options:
  --verbose                Turn on verbose output                                                                                [boolean] [default: false]
  --no-color, --no-colors  Turn off the color in output                                                                          [boolean] [default: false]
  --json                   Turn on the JSON logger                                                                               [boolean] [default: false]
  -h, --help               Show help                                                                                                              [boolean]
  -v, --version            Show the version of the Gatsby CLI and the Gatsby package in the current project                                       [boolean]
+ gatsby-cli@2.8.29
updated 1 package in 9.952s
cstamas@Albert ~/Worx/aura/www01  (master *)$ gatsby clean

 ERROR 

gatsby clean

Wipe the local gatsby environment including built assets and cache

Options:
  --verbose                Turn on verbose output                                                                                [boolean] [default: false]
  --no-color, --no-colors  Turn off the color in output                                                                          [boolean] [default: false]
  --json                   Turn on the JSON logger                                                                               [boolean] [default: false]
  -h, --help               Show help                                                                                                              [boolean]
  -v, --version            Show the version of the Gatsby CLI and the Gatsby package in the current project                                       [boolean]


 ERROR 

There was a problem loading the local clean command. Gatsby may not be installed. Perhaps you need to run "npm install"? Cannot find module '../ink/components/progress-bar'
Require stack:
- /home/cstamas/Worx/aura/www01/node_modules/gatsby/node_modules/gatsby-cli/lib/reporter/loggers/ink/cli.js
- /home/cstamas/Worx/aura/www01/node_modules/gatsby/node_modules/gatsby-cli/lib/reporter/loggers/ink/index.js
- /home/cstamas/Worx/aura/www01/node_modules/gatsby/node_modules/gatsby-cli/lib/reporter/index.js
- /home/cstamas/Worx/aura/www01/node_modules/gatsby/dist/utils/feedback.js
- /home/cstamas/Worx/aura/www01/node_modules/gatsby/dist/commands/clean.js
- /home/linuxbrew/.linuxbrew/lib/node_modules/gatsby-cli/lib/create-cli.js
- /home/linuxbrew/.linuxbrew/lib/node_modules/gatsby-cli/lib/index.js



  Error: Cannot find module '../ink/components/progress-bar'
  Require stack:
  - /home/cstamas/Worx/aura/www01/node_modules/gatsby/node_modules/gatsby-cli/lib/reporter/loggers/ink/cli.js
  - /home/cstamas/Worx/aura/www01/node_modules/gatsby/node_modules/gatsby-cli/lib/reporter/loggers/ink/index.js
  - /home/cstamas/Worx/aura/www01/node_modules/gatsby/node_modules/gatsby-cli/lib/reporter/index.js
  - /home/cstamas/Worx/aura/www01/node_modules/gatsby/dist/utils/feedback.js
  - /home/cstamas/Worx/aura/www01/node_modules/gatsby/dist/commands/clean.js
  - /home/linuxbrew/.linuxbrew/lib/node_modules/gatsby-cli/lib/create-cli.js
  - /home/linuxbrew/.linuxbrew/lib/node_modules/gatsby-cli/lib/index.js
  
  - loader.js:976 Function.Module._resolveFilename
    internal/modules/cjs/loader.js:976:15
  
  - loader.js:859 Function.Module._load
    internal/modules/cjs/loader.js:859:27
  
  - loader.js:1036 Module.require
    internal/modules/cjs/loader.js:1036:19
  
  - helpers.js:72 require
    internal/modules/cjs/helpers.js:72:18
  
  - cli.js:22 Object.<anonymous>
    [www01]/[gatsby]/[gatsby-cli]/lib/reporter/loggers/ink/cli.js:22:20
  
  - loader.js:1147 Module._compile
    internal/modules/cjs/loader.js:1147:30
  
  - loader.js:1167 Object.Module._extensions..js
    internal/modules/cjs/loader.js:1167:10
  
  - loader.js:996 Module.load
    internal/modules/cjs/loader.js:996:32
  
  - loader.js:896 Function.Module._load
    internal/modules/cjs/loader.js:896:14
  
  - loader.js:1036 Module.require
    internal/modules/cjs/loader.js:1036:19
  

cstamas@Albert ~/Worx/aura/www01  (master *)$ 

I fixed it by updating gatsby npm update gatsby

Went thru 2.10.3, 2.10.2 and 2.10.1, all have same error (and does not work). Would be cool if you could tag some “stable” version with “stable” tag 😄

Hey, @blainekasten Getting This error tried every method mentioned in this thread.

8:59:49 PM: /opt/build/repo/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
8:59:49 PM:         throw ex;
8:59:49 PM:         ^
8:59:49 PM: Error: Cannot find module 'babel-plugin-apply-mdx-type-prop'
8:59:49 PM: Require stack:
8:59:49 PM: - /opt/build/repo/node_modules/@mdx-js/runtime/node_modules/@mdx-js/mdx/mdx-hast-to-jsx.js
8:59:49 PM: - /opt/build/repo/node_modules/@mdx-js/runtime/node_modules/@mdx-js/mdx/index.js
8:59:49 PM: - /opt/build/repo/node_modules/@mdx-js/runtime/dist/cjs.js
8:59:49 PM: - /opt/build/repo/node_modules/gatsby-recipes/dist/cli.js
8:59:49 PM: - /opt/build/repo/node_modules/gatsby-recipes/dist/index.js
8:59:49 PM: - /opt/build/repo/node_modules/gatsby-cli/lib/recipes.js
8:59:49 PM: - /opt/build/repo/node_modules/gatsby-cli/lib/create-cli.js
8:59:49 PM: - /opt/build/repo/node_modules/gatsby-cli/lib/index.js
8:59:49 PM: - /opt/build/repo/node_modules/gatsby-cli/cli.js
8:59:49 PM:     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
8:59:49 PM:     at Function.Module._load (internal/modules/cjs/loader.js:842:27)
8:59:49 PM:     at Module.require (internal/modules/cjs/loader.js:1026:19)
8:59:49 PM:     at require (internal/modules/cjs/helpers.js:72:18)
8:59:49 PM:     at Object.<anonymous> (/opt/build/repo/node_modules/@mdx-js/runtime/node_modules/@mdx-js/mdx/mdx-hast-to-jsx.js:6:33)
8:59:49 PM:     at Module._compile (internal/modules/cjs/loader.js:1138:30)
8:59:49 PM:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
8:59:49 PM:     at Module.load (internal/modules/cjs/loader.js:986:32)
8:59:49 PM:     at Function.Module._load (internal/modules/cjs/loader.js:879:14)
8:59:49 PM:     at Module.require (internal/modules/cjs/loader.js:1026:19) {
8:59:49 PM:   code: 'MODULE_NOT_FOUND',
8:59:49 PM:   requireStack: [
8:59:49 PM:     '/opt/build/repo/node_modules/@mdx-js/runtime/node_modules/@mdx-js/mdx/mdx-hast-to-jsx.js',
8:59:49 PM:     '/opt/build/repo/node_modules/@mdx-js/runtime/node_modules/@mdx-js/mdx/index.js',
8:59:49 PM:     '/opt/build/repo/node_modules/@mdx-js/runtime/dist/cjs.js',
8:59:49 PM:     '/opt/build/repo/node_modules/gatsby-recipes/dist/cli.js',
8:59:49 PM:     '/opt/build/repo/node_modules/gatsby-recipes/dist/index.js',
8:59:49 PM:     '/opt/build/repo/node_modules/gatsby-cli/lib/recipes.js',
8:59:49 PM:     '/opt/build/repo/node_modules/gatsby-cli/lib/create-cli.js',
8:59:49 PM:     '/opt/build/repo/node_modules/gatsby-cli/lib/index.js',
8:59:49 PM:     '/opt/build/repo/node_modules/gatsby-cli/cli.js'
8:59:49 PM:   ]
8:59:49 PM: }
8:59:49 PM: ​
8:59:49 PM: ┌─────────────────────────────┐
8:59:49 PM: │   "build.command" failed    │
8:59:49 PM: └─────────────────────────────┘
8:59:49 PM: ​
8:59:49 PM:   Error message
8:59:49 PM:   Command failed with exit code 7: gatsby build
8:59:49 PM: ​
8:59:49 PM:   Error location
8:59:49 PM:   In Build command from Netlify app:
8:59:49 PM:   gatsby build
8:59:49 PM: ​
8:59:49 PM:   Resolved config
8:59:49 PM:   build:
8:59:49 PM:     command: gatsby build
8:59:49 PM:     commandOrigin: ui
8:59:49 PM:     publish: /opt/build/repo/public

Had the same issue (Error: Cannot find module 'ink') with "gatsby": "^2.19.14", "gatsby-cli": "^2.12.46",.

Fixed it by deleting node_modules and package-lock.json and relocking with $ npm install.

Sorry friends! And thank you for reporting. I’ve got a fix up here. I’ll try to get a release out today if I can get it merged.

Unfortunately, "gatsby-cli": "^2.10.3" is still throwing the same error on every gatsby ... command. Even after reinstalling global and local node_modules.

@blainekasten I fixed it by including gatsby-cli in my package.lock. I’ll try to run a build later today without it included and with @mskrip’s solution instead to see what happens.

@blainekasten @rennehir I’ve fixed issue by installing optional deps, because as for now I’ve been using npm i --no-optional on CI environment, but currently for Gatsby it is not possible.

If ink is required for build process, I think it should not be marked optional.

I’m also experiencing this when building my site on Netlify. I have cleared cache etc on Netlify. Locally the build works with no problems.

gatsby-cli@2.12.35 gatsby@2.20.19 Netlify build image: Ubuntu Xenial 16.04 (default)

> gatsby build
/opt/build/repo/web/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
        throw ex;
        ^
Error: Cannot find module 'ink'
    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:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/opt/build/repo/web/node_modules/ink-box/dist.js:5:12)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789: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)

Somehow, I had to manually remove /usr/local/bin/gatsby, /usr/local/lib/node_modules/gatsby and /usr/local/lib/node_modules/gatsby-cli and after running npm install -g gatsby-cli to get it all working again.

💁‍♂️This worked in my specific case, hopefully it helps if you’re stuck after reading the above.

@mmafe please make sure that gatsby and gatsby-cli in package.json as following "gatsby": "^2.19.34", "gatsby-cli": "^2.10.4",

So the fix then implies, that globally and locally (in package.json as direct dependency, to be on safe side) should be kept in sync?

Worst timing ever to have an version upgrade for me! Works now. Thanks @blainekasten !

But from an architectural perspective, gatsby-cli, that is needed to be installed globally, is also dependency of gatsby (used a dependency, as this is gatsby project). So, if that’s the case, then basically gatsby is the one “defining” the version of gatsby-cli, NOT the one you install globally?

@cstamas i have gatsby 2.8.29 on my local machine and it’s working fine, can you try?

This version is working for me on a new site. Thanks