gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.

Home Page:https://www.gatsbyjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

danoszz opened this issue Β· comments

commented

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.

If I had to guess, this would be the culprit. I'll try and put a PR together

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

commented

@herecydev and @blainekasten so quick! Thank you for the sharp eye(s), couldn't figure it out myself.

i have the same issue, shall downgrade gatsbyjs-cli or wating for the hotfix to be out?

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

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 πŸ˜„

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

@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

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 *)$ 

hm, maybe version of gatsby?

cstamas@Albert ~/Worx/aura/www01  (master *)$ gatsby -v
Gatsby CLI version: 2.8.29
Gatsby version: 2.19.33
  Note: this is the Gatsby version for the site at: /home/cstamas/Worx/aura/www01
cstamas@Albert ~/Worx/aura/www01  (master *)$ 

Heh, so...

gatsby (dep present in package.json) declares dep on gatsby-cli 2.10.3 :) (why on earth?)
And gatsby-cli 2.10.3 as we know is busted. Basically, as I see, gatsby clean goes into "embedded" gatsby cli instead of my globally installed one?

commented

For now running npm run develop on version 2.10.3, is working! But gatsby-develop got: Error: Cannot find module '../ink/components/progress-bar'

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?

commented

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

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! 😒 πŸ’œ

commented

@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. :)

Heh, ok, so this fixed it

cstamas@Albert ~/Worx/aura/www01  (master *)$ gatsby -v
Gatsby CLI version: 2.10.4
Gatsby version: 2.19.34
  Note: this is the Gatsby version for the site at: /home/cstamas/Worx/aura/www01
cstamas@Albert ~/Worx/aura/www01  (master *)$ 

But am still puzzled by this (as shown by stack trace): if gatsby CLI is using globally installed gatsby-cli to execute gatsby's dependency gatsby-cli..... what's the point of the version you have globally installed gatsby-cli?

Thanks @blainekasten ! It works for me, after the update!

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

Fixed it for me as well, thanks for being so quick on the issue!

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

Working for me too. Thanks for the quick fix.

@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?

commented

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.

commented

Thanks @danoszz - that did it!

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.

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! 😒 πŸ’œ

Nice! Thank you for fixing! πŸŽ‰

@blainekasten
gatsby-cli@2.12.34
gatsby@2.22.9
node:12-alpine docker image

Error: Cannot find module 'ink'
Require stack:
  - /project/node_modules/gatsby/node_modules/gatsby-cli/lib/reporter/loggers/ink/index.js
- /project/node_modules/gatsby/node_modules/gatsby-cli/lib/reporter/start-logger.js
- /project/node_modules/gatsby/node_modules/gatsby-cli/lib/reporter/index.js
- /project/node_modules/gatsby/node_modules/gatsby-cli/lib/create-cli.js
- /project/node_modules/gatsby/node_modules/gatsby-cli/lib/index.js
- /project/node_modules/gatsby/dist/bin/gatsby.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
at Function.Module._load (internal/modules/cjs/loader.js:864:27)
at Module.require (internal/modules/cjs/loader.js:1044:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (/project/node_modules/gatsby/node_modules/gatsby-cli/lib/reporter/loggers/ink/index.js:12:12)
at Module._compile (internal/modules/cjs/loader.js:1158:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
at Module.load (internal/modules/cjs/loader.js:1002:32)
at Function.Module._load (internal/modules/cjs/loader.js:901:14)
at Module.require (internal/modules/cjs/loader.js:1044:19) {
  code: 'MODULE_NOT_FOUND',
    requireStack: [
    '/project/node_modules/gatsby/node_modules/gatsby-cli/lib/reporter/loggers/ink/index.js',
    '/project/node_modules/gatsby/node_modules/gatsby-cli/lib/reporter/start-logger.js',
    '/project/node_modules/gatsby/node_modules/gatsby-cli/lib/reporter/index.js',
    '/project/node_modules/gatsby/node_modules/gatsby-cli/lib/create-cli.js',
    '/project/node_modules/gatsby/node_modules/gatsby-cli/lib/index.js',
    '/project/node_modules/gatsby/dist/bin/gatsby.js'
  ]
}

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)

@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.

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.

Published a new version to fix it, gatsby-cli@2.12.37

Error just showed up again with a Netlify build:

Netlify ran:
gatsby-cli@2.12.40 postinstall /opt/build/repo/node_modules/gatsby/node_modules/gatsby-cli

But eventually it ended with:
Error: Cannot find module 'ink'

I installed gatsby-cli@2.12.40 but the error still happened

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.

@salomonMuriel @dragonza can you try the same thing that @mskrip did?

@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.

I fixed it by updating gatsby npm update gatsby

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.

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

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

Received the same error today. Trying the npm update gatsby fix

10:02:34 AM: build-image version: ca811f47d4c1cbd1812d1eb6ecb0c977e86d1a1d
10:02:34 AM: build-image tag: v3.3.20
10:02:34 AM: buildbot version: be8ecf2af866e16fa4301cc5c14de2ccbbb21cf4
10:02:35 AM: Fetching cached dependencies
10:02:35 AM: Starting to download cache of 163.6MB
10:02:40 AM: Finished downloading cache in 5.902980004s
10:02:40 AM: Starting to extract cache
10:02:51 AM: Finished extracting cache in 10.83523532s
10:02:52 AM: Finished fetching cache in 17.172564354s
10:02:52 AM: Starting to prepare the repo for build
10:02:52 AM: Preparing Git Reference refs/heads/master
10:02:55 AM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'public' versus 'public/' in the Netlify UI
10:02:55 AM: Starting build script
10:02:55 AM: Installing dependencies
10:02:55 AM: Python version set to 2.7
10:02:56 AM: Started restoring cached node version
10:02:59 AM: Finished restoring cached node version
10:03:00 AM: v12.18.0 is already installed.
10:03:00 AM: Now using node v12.18.0 (npm v6.14.4)
10:03:00 AM: Started restoring cached build plugins
10:03:00 AM: Finished restoring cached build plugins
10:03:01 AM: Attempting ruby version 2.7.1, read from environment
10:03:02 AM: Using ruby version 2.7.1
10:03:02 AM: Using PHP version 5.6
10:03:02 AM: 5.2 is already installed.
10:03:02 AM: Using Swift version 5.2
10:03:02 AM: Started restoring cached node modules
10:03:03 AM: Finished restoring cached node modules
10:03:03 AM: Installing NPM modules using NPM version 6.14.4
10:03:22 AM: > gatsby-telemetry@1.3.24 postinstall /opt/build/repo/node_modules/gatsby/node_modules/gatsby-cli/node_modules/gatsby-telemetry
10:03:22 AM: > node src/postinstall.js || true
10:03:22 AM: > gatsby-cli@2.12.68 postinstall /opt/build/repo/node_modules/gatsby/node_modules/gatsby-cli
10:03:22 AM: > node scripts/postinstall.js
10:03:24 AM: npm WARN @pmmmwh/react-refresh-webpack-plugin@0.3.3 requires a peer of react-refresh@^0.8.2 but none is installed. You must install peer dependencies yourself.
10:03:24 AM: npm WARN acorn-dynamic-import@4.0.0 requires a peer of acorn@^6.0.0 but none is installed. You must install peer dependencies yourself.
10:03:24 AM: npm WARN ink-box@1.0.0 requires a peer of ink@>=2.0.0 but none is installed. You must install peer dependencies yourself.
10:03:24 AM: npm WARN ink-link@1.1.0 requires a peer of ink@>=2.0.0 but none is installed. You must install peer dependencies yourself.
10:03:24 AM: npm WARN ink-select-input@3.1.2 requires a peer of ink@^2.0.0 but none is installed. You must install peer dependencies yourself.
10:03:24 AM: npm WARN tsutils@3.17.1 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
10:03:24 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/chokidar/node_modules/fsevents):
10:03:24 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
10:03:24 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/fsevents):
10:03:24 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
10:03:24 AM: added 125 packages from 48 contributors, removed 222 packages, updated 44 packages and audited 2380 packages in 20.19s
10:03:26 AM: 143 packages are looking for funding
10:03:26 AM:   run `npm fund` for details
10:03:26 AM: found 2 high severity vulnerabilities
10:03:26 AM:   run `npm audit fix` to fix them, or `npm audit` for details
10:03:26 AM: NPM modules installed
10:03:26 AM: Started restoring cached go cache
10:03:26 AM: Finished restoring cached go cache
10:03:26 AM: go version go1.14.4 linux/amd64
10:03:26 AM: go version go1.14.4 linux/amd64
10:03:26 AM: Installing missing commands
10:03:26 AM: Verify run directory
10:03:27 AM: ​
10:03:27 AM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
10:03:27 AM: β”‚        Netlify Build        β”‚
10:03:27 AM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
10:03:27 AM: ​
10:03:27 AM: ❯ Version
10:03:27 AM:   @netlify/build 3.0.1
10:03:27 AM: ​
10:03:27 AM: ❯ Flags
10:03:27 AM:   deployId: 5f27b6895a09680007c5b09f
10:03:27 AM:   mode: buildbot
10:03:27 AM: ​
10:03:27 AM: ❯ Current directory
10:03:27 AM:   /opt/build/repo
10:03:27 AM: ​
10:03:27 AM: ❯ Config file
10:03:27 AM:   No config file was defined: using default values.
10:03:27 AM: ​
10:03:27 AM: ❯ Context
10:03:27 AM:   production
10:03:27 AM: ​
10:03:27 AM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
10:03:27 AM: β”‚ 1. Build command from Netlify app β”‚
10:03:27 AM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
10:03:27 AM: ​
10:03:27 AM: $ gatsby build
10:03:29 AM: /opt/build/repo/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
10:03:29 AM:         throw ex;
10:03:29 AM:         ^
10:03:29 AM: Error: Cannot find module 'ink'
10:03:29 AM: Require stack:
10:03:29 AM: - /opt/build/repo/node_modules/ink-box/dist.js
10:03:29 AM: - /opt/build/repo/node_modules/gatsby/node_modules/gatsby-cli/node_modules/gatsby-recipes/dist/cli.js
10:03:29 AM: - /opt/build/repo/node_modules/gatsby/node_modules/gatsby-cli/node_modules/gatsby-recipes/dist/index.js
10:03:29 AM: - /opt/build/repo/node_modules/gatsby/node_modules/gatsby-cli/lib/recipes.js
10:03:29 AM: - /opt/build/repo/node_modules/gatsby/node_modules/gatsby-cli/lib/create-cli.js
10:03:29 AM: - /opt/build/repo/node_modules/gatsby/node_modules/gatsby-cli/lib/index.js
10:03:29 AM: - /opt/build/repo/node_modules/gatsby/dist/bin/gatsby.js
10:03:29 AM: - /opt/build/repo/node_modules/gatsby/cli.js
10:03:29 AM:     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
10:03:29 AM:     at Function.Module._load (internal/modules/cjs/loader.js:842:27)
10:03:29 AM:     at Module.require (internal/modules/cjs/loader.js:1026:19)
10:03:29 AM:     at require (internal/modules/cjs/helpers.js:72:18)
10:03:29 AM:     at Object.<anonymous> (/opt/build/repo/node_modules/ink-box/dist.js:5:12)
10:03:29 AM:     at Module._compile (internal/modules/cjs/loader.js:1138:30)
10:03:29 AM:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
10:03:29 AM:     at Module.load (internal/modules/cjs/loader.js:986:32)
10:03:29 AM:     at Function.Module._load (internal/modules/cjs/loader.js:879:14)
10:03:29 AM:     at Module.require (internal/modules/cjs/loader.js:1026:19) {
10:03:29 AM:   code: 'MODULE_NOT_FOUND',
10:03:29 AM:   requireStack: [
10:03:29 AM:     '/opt/build/repo/node_modules/ink-box/dist.js',
10:03:29 AM:     '/opt/build/repo/node_modules/gatsby/node_modules/gatsby-cli/node_modules/gatsby-recipes/dist/cli.js',
10:03:29 AM:     '/opt/build/repo/node_modules/gatsby/node_modules/gatsby-cli/node_modules/gatsby-recipes/dist/index.js',
10:03:29 AM:     '/opt/build/repo/node_modules/gatsby/node_modules/gatsby-cli/lib/recipes.js',
10:03:29 AM:     '/opt/build/repo/node_modules/gatsby/node_modules/gatsby-cli/lib/create-cli.js',
10:03:29 AM:     '/opt/build/repo/node_modules/gatsby/node_modules/gatsby-cli/lib/index.js',
10:03:29 AM:     '/opt/build/repo/node_modules/gatsby/dist/bin/gatsby.js',
10:03:29 AM:     '/opt/build/repo/node_modules/gatsby/cli.js'
10:03:29 AM:   ]
10:03:29 AM: }
10:03:29 AM: ​
10:03:29 AM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
10:03:29 AM: β”‚   "build.command" failed    β”‚
10:03:29 AM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
10:03:29 AM: ​
10:03:29 AM:   Error message
10:03:29 AM:   Command failed with exit code 7: gatsby build
10:03:29 AM: ​
10:03:29 AM:   Error location
10:03:29 AM:   In Build command from Netlify app:
10:03:29 AM:   gatsby build
10:03:29 AM: ​
10:03:29 AM:   Resolved config
10:03:29 AM:   build:
10:03:29 AM:     command: gatsby build
10:03:29 AM:     commandOrigin: ui
10:03:29 AM:     publish: /opt/build/repo/public
10:03:29 AM: Caching artifacts
10:03:29 AM: Started saving node modules
10:03:29 AM: Finished saving node modules
10:03:29 AM: Started saving build plugins
10:03:29 AM: Finished saving build plugins
10:03:29 AM: Started saving pip cache
10:03:29 AM: Finished saving pip cache
10:03:29 AM: Started saving emacs cask dependencies
10:03:29 AM: Finished saving emacs cask dependencies
10:03:29 AM: Started saving maven dependencies
10:03:29 AM: Finished saving maven dependencies
10:03:29 AM: Started saving boot dependencies
10:03:29 AM: Finished saving boot dependencies
10:03:29 AM: Started saving go dependencies
10:03:29 AM: Finished saving go dependencies
10:03:29 AM: Error running command: Build script returned non-zero exit code: 1
10:03:29 AM: Failing build: Failed to build site
10:03:29 AM: Failed during stage 'building site': Build script returned non-zero exit code: 1
10:03:29 AM: Finished processing build request in 54.667382629s ```

npm update gatsby worked for me

@blainekasten I tried, it fixed the error but I ran into another issue preventing me from running the local development.


> gatsby develop

/Users/alexmyvuong/Projects/mobify-platform-sdks/packages/devcenter/node_modules/gatsby-recipes/node_modules/graphql/jsutils/instanceOf.js:28
      throw new Error("Cannot use ".concat(className, " \"").concat(value, "\" from another module or realm.\n\nEnsure that there is only one instance of \"graphql\" in the node_modules\ndirectory. If different versions of \"graphql\" are the dependencies of other\nrelied on modules, use \"resolutions\" to ensure only one version is installed.\n\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\n\nDuplicate \"graphql\" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results."));
      ^

Error: Cannot use GraphQLInputObjectType "FileInput" from another module or realm.

Ensure that there is only one instance of "graphql" in the node_modules
directory. If different versions of "graphql" are the dependencies of other
relied on modules, use "resolutions" to ensure only one version is installed.

I ran npm ls graphql, here is the result

β”œβ”€β”¬ @playlyfe/gql@2.6.2
β”‚ β”œβ”€β”¬ apollo-codegen@0.10.13
β”‚ β”‚ └── graphql@0.9.6 
β”‚ β”œβ”€β”€ graphql@0.9.6 
β”‚ └─┬ graphql-language-service-interface@0.0.11
β”‚   β”œβ”€β”€ graphql@0.9.6 
β”‚   β”œβ”€β”¬ graphql-language-service-types@0.0.16
β”‚   β”‚ └── graphql@0.9.6 
β”‚   └─┬ graphql-language-service-utils@0.0.10
β”‚     └── graphql@0.9.6 
β”œβ”€β”¬ gatsby@2.24.33
β”‚ └── graphql@14.7.0 
β”œβ”€β”¬ gatsby-cli@2.12.77
β”‚ └─┬ gatsby-recipes@0.2.7
β”‚   └── graphql@14.7.0 
└── graphql@14.5.8 

Any idea how to fix this?

@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!

just use yarn instead of npm, it will work