Gatsby: installing gatsby with --no-optional breaks gatsby-cli

Created on 28 May 2019  路  3Comments  路  Source: gatsbyjs/gatsby

Description

When people install gatsby with --no-optional gatsby breaks because ink is not being installed. We made ink optional because of node 6 #14233

We should fix our check here
https://github.com/gatsbyjs/gatsby/blob/6070279f68aab0c82f2d244f54088f8ad4a74503/packages/gatsby-cli/src/reporter/reporters/index.js#L4-L8

let inkExists;
try {
  require.resolve('ink')
  inkExists = true
} catch(err) {}

if (inkExists && !isCI) {

Steps to reproduce

open a gatsby project and run
npm install --no-optional
npm run build build

Expected result

Gatsby should build the website.

Actual result

> [email protected] build C:\Users\WardPeeters\projectswin\tmp\gatsby\my-default-starter
> gatsby build

internal/modules/cjs/loader.js:584
    throw err;
    ^

Error: Cannot find module 'ink'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
    at Function.Module._load (internal/modules/cjs/loader.js:508:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (C:\Users\WardPeeters\projectswin\tmp\gatsby\my-default-starter\node_modules\gatsby\node_modules\gatsby-cli\lib\reporter\reporters\ink\index.js:10:12)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)

Copied from https://github.com/gatsbyjs/gatsby/pull/14233#issuecomment-495895945

good first issue help wanted confirmed bug

Most helpful comment

I can hop on this!

All 3 comments

I can hop on this!

Awesome! thanks, @ryandrew14 just shout if you need any assistance.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dustinhorton picture dustinhorton  路  3Comments

ferMartz picture ferMartz  路  3Comments

andykais picture andykais  路  3Comments

totsteps picture totsteps  路  3Comments

theduke picture theduke  路  3Comments