Gatsby: "gatsby new" fails on eslint-loader

Created on 22 Dec 2018  Â·  11Comments  Â·  Source: gatsbyjs/gatsby

Description

$gatsby new consistently fails to compile.

Steps to reproduce

$gatsby new home

Expected result

successful compilation

Actual result

Log from command line follows:

Module Error (from ./node_modules/eslint-loader/index.js):

/home/bjpcjp/projects/code/js/gatsby/home/src/components/image.js
  21:11  error  Cannot query field "childImageSharp" on type "File"  graphql/template-strings

✖ 1 problem (1 error, 0 warnings)

 @ ./src/pages/index.js 10:0-40 22:25-30
 @ ./.cache/sync-requires.js
 @ ./.cache/app.js
 @ multi (webpack)-hot-middleware/client.js?path=/__webpack_hmr&reload=true&overlay=false ./.cache/app

✖ 「wdm」: 
ERROR in ./src/components/image.js
Module Error (from ./node_modules/eslint-loader/index.js):

/home/bjpcjp/projects/code/js/gatsby/home/src/components/image.js
  21:11  error  Cannot query field "childImageSharp" on type "File"  graphql/template-strings

✖ 1 problem (1 error, 0 warnings)

 @ ./src/pages/index.js 10:0-40 22:25-30
 @ ./.cache/sync-requires.js
 @ ./.cache/app.js
 @ multi (webpack)-hot-middleware/client.js?path=/__webpack_hmr&reload=true&overlay=false ./.cache/app
ℹ 「wdm」: Failed to compile.

Environment

  System:
    OS: Linux 4.4 Ubuntu 14.04.5 LTS, Trusty Tahr
    CPU: (8) x64 Intel(R) Core(TM) i7-4710MQ CPU @ 2.50GHz
    Shell: 4.3.11 - /bin/bash
  Binaries:
    Node: 10.6.0 - ~/.nvm/versions/node/v10.6.0/bin/node
    Yarn: 1.10.1 - /usr/bin/yarn
    npm: 6.4.1 - ~/.nvm/versions/node/v10.6.0/bin/npm
  Browsers:
    Firefox: 59.0
  npmPackages:
    gatsby: ^2.0.53 => 2.0.75 
    gatsby-image: ^2.0.20 => 2.0.25 
    gatsby-plugin-manifest: ^2.0.9 => 2.0.12 
    gatsby-plugin-offline: ^2.0.16 => 2.0.20 
    gatsby-plugin-react-helmet: ^3.0.2 => 3.0.5 
    gatsby-plugin-sharp: ^2.0.14 => 2.0.16 
    gatsby-source-filesystem: ^2.0.8 => 2.0.12 
    gatsby-transformer-sharp: ^2.1.8 => 2.1.9 
  npmGlobalPackages:
    gatsby-cli: 2.4.7

stale? needs more info

Most helpful comment

Hi!
So just to make sure how you encounter this issue:

  1. You go into a directory
  2. Do a gatsby new $name
  3. The above error occurs

Right?

All 11 comments

Hi!
So just to make sure how you encounter this issue:

  1. You go into a directory
  2. Do a gatsby new $name
  3. The above error occurs

Right?

Correct. I’m using an empty directory. Thank you!

Thank you for opening this @bjpcjp

Looks related to https://github.com/gatsbyjs/gatsby/issues/9511

gatsby-plugin-sharp uses node-gyp which according to https://github.com/nodejs/node-gyp needs:

  • python (v2.7 recommended, v3.x.x is not supported)

Can you check what version you have installed?

Thanks @sidharthachatterjee - I'm using Python 3.6.5 via Anaconda.

@bjpcjp That explains it

node-gyp doesn't support v3.x.x unfortunately

Can you please install and switch to v2.7 and try again?

Switched to Python 2.7.6 (Anaconda distro) and entered "$gatsby new homepy27" (empty directory).

Compilation again failed. Error log:

 ERROR  Failed to compile with 1 errors                                                                      11:32:58 AM
 error  in ./src/components/image.js

Module Error (from ./node_modules/eslint-loader/index.js):

/home/bjpcjp/projects/code/js/gatsby/homepy27/src/components/image.js
  21:11  error  Cannot query field "childImageSharp" on type "File"  graphql/template-strings

✖ 1 problem (1 error, 0 warnings)
 @ ./src/pages/index.js 10:0-40 22:25-30
 @ ./.cache/sync-requires.js
 @ ./.cache/app.js
 @ multi (webpack)-hot-middleware/client.js?path=/__webpack_hmr&reload=true&overlay=false ./.cache/app

✖ 「wdm」: 
ERROR in ./src/components/image.js
Module Error (from ./node_modules/eslint-loader/index.js):

/home/bjpcjp/projects/code/js/gatsby/homepy27/src/components/image.js
  21:11  error  Cannot query field "childImageSharp" on type "File"  graphql/template-strings

✖ 1 problem (1 error, 0 warnings)

 @ ./src/pages/index.js 10:0-40 22:25-30
 @ ./.cache/sync-requires.js
 @ ./.cache/app.js
 @ multi (webpack)-hot-middleware/client.js?path=/__webpack_hmr&reload=true&overlay=false ./.cache/app
ℹ 「wdm」: Failed to compile.

Same issue on a fresh install. I'm also on python 2.7.

Can you paste full terminal output? There might be some clues earlier

@bjpcjp @brookslyrette Can you check if 3 is the default? I have a feeling node is still calling 3. After switching to 2.7 in Anaconda, can you run ?

  • npm install --global gatsby-cli
  • gatsby new gatsby-site
  • cd gatsby-site
  • gatsby develop

@siddharthkp Root cause is the same as #9511.

Installing the older version of plugin-manifest fixed it for now. https://github.com/gatsbyjs/gatsby/issues/9511#issuecomment-433986013

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here.

If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!

Thanks for being a part of the Gatsby community! 💪💜

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mikestopcontinues picture mikestopcontinues  Â·  3Comments

3CordGuy picture 3CordGuy  Â·  3Comments

theduke picture theduke  Â·  3Comments

dustinhorton picture dustinhorton  Â·  3Comments

ghost picture ghost  Â·  3Comments