Gatsby: The "gatsby develop" command throws the "There are no available GQL nodes" error

Created on 19 Sep 2018  Β·  21Comments  Β·  Source: gatsbyjs/gatsby

Description

The "gatsby develop" command throws the "There are no available GQL nodes" error

Steps to reproduce

Just follow steps from the Getting Started guide.

npm install --global gatsby-cli
gatsby new gatsby-site https://github.com/gatsbyjs/gatsby-starter-default
cd gatsby-site
gatsby develop

Expected result

Should work.

Actual result

Throws the error.

Environment

System:
OS: Linux 4.13 Ubuntu 17.10 (Artful Aardvark)
CPU: x64 Intel(R) Core(TM) i5-2400 CPU @ 3.10GHz
Shell: 4.4.12 - /bin/bash
Binaries:
Node: 10.6.0 - /usr/bin/node
Yarn: 1.9.4 - /usr/bin/yarn
npm: 6.1.0 - /usr/bin/npm
Browsers:
Chrome: 69.0.3497.92
Firefox: 61.0.1
npmPackages:
gatsby: ^2.0.0 => 2.0.4
npmGlobalPackages:
gatsby-cli: 2.4.1

stale? needs more info

Most helpful comment

@SAGGameDeveloper if that's the case, then @Manoz for instance which has the content inside a folder with the following way `dd-mm-yyy also doesn't work for him, but for me it does, on either case, i.e: linux on wsl and win 10. Also if that's the case, the library not allowing special characters of combinations of characters, then the plugin should throw the appropriate message in the error not a generic one.

All 21 comments

@SergeyAlexeev can you share the complete error? I'm unable to reproduce this issue.

Sure, I'll provide a call stack later. Today evening.

The callstack:

success open and validate gatsby-config β€” 0.007 s
success load plugins β€” 0.182 s
success onPreInit β€” 0.006 s
success delete html and css files from previous builds β€” 0.005 s
success initialize cache β€” 0.008 s
success copy gatsby files β€” 0.033 s
success onPreBootstrap β€” 0.000 s
warning The internal-data-bridge plugin has generated no Gatsby nodes. Do you need it?
success source and transform nodes β€” 0.001 s
error There are no available GQL nodes

Error: Invariant Violation: There are no available GQL nodes

  • invariant.js:40 invariant
    [gatsby-site]/[invariant]/invariant.js:40:15
  • index.js:38
    [gatsby-site]/[gatsby]/dist/schema/index.js:38:5
  • Generator.next
  • util.js:16 tryCatcher
    [lib]/[gatsby-cli]/[bluebird]/js/release/util.js:16:23
  • promise.js:512 Promise._settlePromiseFromHandler
    [lib]/[gatsby-cli]/[bluebird]/js/release/promise.js:512:31
  • promise.js:569 Promise._settlePromise
    [lib]/[gatsby-cli]/[bluebird]/js/release/promise.js:569:18
  • promise.js:614 Promise._settlePromise0
    [lib]/[gatsby-cli]/[bluebird]/js/release/promise.js:614:10
  • promise.js:694 Promise._settlePromises
    [lib]/[gatsby-cli]/[bluebird]/js/release/promise.js:694:18
  • async.js:138 _drainQueueStep
    [lib]/[gatsby-cli]/[bluebird]/js/release/async.js:138:12
  • async.js:131 _drainQueue
    [lib]/[gatsby-cli]/[bluebird]/js/release/async.js:131:9
  • async.js:147 Async._drainQueues
    [lib]/[gatsby-cli]/[bluebird]/js/release/async.js:147:5
  • async.js:17 Immediate.Async.drainQueues [as _onImmediate]
    [lib]/[gatsby-cli]/[bluebird]/js/release/async.js:17:14

error UNHANDLED REJECTION

@SergeyAlexeev Are you able to post your versions for Node, gatsby-cli, and gatsby (from gatsby-site/package-lock)?

I just tried a bunch of variations on starter versions, Node versions and the like, but I still could not recreate this specific error. I got through bootstrap every time.

Node v10.6.0
gatsby-cli 2.4.1
gatsby 2.0.2

Same issue...

> gatsby develop

Something is already running at port 8000 
Would you like to run the app at another port instead? [Y/n] y
success open and validate gatsby-config β€” 0.005 s
success load plugins β€” 0.188 s
success onPreInit β€” 0.010 s
success delete html and css files from previous builds β€” 0.006 s
success initialize cache β€” 0.006 s
success copy gatsby files β€” 0.008 s
success onPreBootstrap β€” 0.000 s
warning The internal-data-bridge plugin has generated no Gatsby nodes. Do you need it?
warning The gatsby-source-filesystem plugin has generated no Gatsby nodes. Do you need it?
success source and transform nodes β€” 0.001 s
error There are no available GQL nodes


  Error: Invariant Violation: There are no available GQL nodes

@Manoz can you provide relevant environment info by running gatsby info --clipboard?

@Manoz can you provide relevant environment info by running gatsby info --clipboard?

Everything looks ok on Windows or Mac. Just have the issue on my working computer.
Will share the stack tomorrow morning :)

@kakadiadarpan here's the env infos:

  System:
    OS: Linux 4.15 Ubuntu 18.04.1 LTS (Bionic Beaver)
    CPU: x64 Intel(R) Pentium(R) Silver N5000 CPU @ 1.10GHz
    Shell: 5.4.2 - /usr/bin/zsh
  Binaries:
    Node: 11.0.0 - /usr/local/bin/node
    Yarn: 1.12.1 - /usr/local/bin/yarn
    npm: 6.4.1 - /usr/local/bin/npm
  Browsers:
    Chrome: 70.0.3538.77
    Firefox: 63.0
  npmPackages:
    gatsby: ^2.0.40 => 2.0.40 
    gatsby-plugin-catch-links: ^2.0.6 => 2.0.6 
    gatsby-plugin-eslint: ^2.0.1 => 2.0.1 
    gatsby-plugin-feed: ^2.0.9 => 2.0.9 
    gatsby-plugin-google-analytics: ^2.0.7 => 2.0.7 
    gatsby-plugin-google-fonts: ^0.0.4 => 0.0.4 
    gatsby-plugin-lodash: ^3.0.2 => 3.0.2 
    gatsby-plugin-manifest: ^2.0.7 => 2.0.7 
    gatsby-plugin-netlify: ^2.0.3 => 2.0.3 
    gatsby-plugin-nprogress: ^2.0.6 => 2.0.6 
    gatsby-plugin-offline: ^2.0.12 => 2.0.12 
    gatsby-plugin-react-helmet: ^3.0.1 => 3.0.1 
    gatsby-plugin-sharp: ^2.0.12 => 2.0.12 
    gatsby-plugin-sitemap: ^2.0.2 => 2.0.2 
    gatsby-plugin-styled-components: ^3.0.1 => 3.0.1 
    gatsby-plugin-twitter: ^2.0.7 => 2.0.7 
    gatsby-remark-autolink-headers: ^2.0.10 => 2.0.10 
    gatsby-remark-copy-linked-files: ^2.0.6 => 2.0.6 
    gatsby-remark-images: ^2.0.6 => 2.0.6 
    gatsby-remark-prismjs: ^3.0.3 => 3.0.3 
    gatsby-remark-responsive-iframe: ^2.0.6 => 2.0.6 
    gatsby-source-filesystem: ^2.0.7 => 2.0.7 
    gatsby-transformer-remark: ^2.1.11 => 2.1.11 
    gatsby-transformer-sharp: ^2.1.8 => 2.1.8 
  npmGlobalPackages:
    gatsby-cli: 2.4.4

Can you provide a repo if possible? Because i'm not being able to reproduce the issue also.
Also delete public and .cache folders. I know that might sound silly, but it has fixed so many bugs for me so many times

I have the same issue everywhere actually but you can try on this repo https://github.com/Manoz/k-legrand.com

@Manoz on the pc i'm using for development currently
with the following output from gatsby info

 System:
    OS: Windows 10
    CPU: x64 Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz
  Binaries:
    Yarn: 1.10.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 5.6.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: 42.17134.1.0
  npmPackages:
    gatsby: ^2.0.40 => 2.0.48
    gatsby-plugin-catch-links: ^2.0.6 => 2.0.8
    gatsby-plugin-eslint: ^2.0.1 => 2.0.1
    gatsby-plugin-feed: ^2.0.9 => 2.0.9
    gatsby-plugin-google-analytics: ^2.0.7 => 2.0.7
    gatsby-plugin-google-fonts: ^0.0.4 => 0.0.4
    gatsby-plugin-lodash: ^3.0.2 => 3.0.2
    gatsby-plugin-manifest: ^2.0.7 => 2.0.9
    gatsby-plugin-netlify: ^2.0.3 => 2.0.4
    gatsby-plugin-nprogress: ^2.0.6 => 2.0.6
    gatsby-plugin-offline: ^2.0.12 => 2.0.14
    gatsby-plugin-react-helmet: ^3.0.1 => 3.0.2
    gatsby-plugin-sharp: ^2.0.12 => 2.0.12
    gatsby-plugin-sitemap: ^2.0.2 => 2.0.2
    gatsby-plugin-styled-components: ^3.0.1 => 3.0.1
    gatsby-plugin-twitter: ^2.0.7 => 2.0.7
    gatsby-remark-autolink-headers: ^2.0.10 => 2.0.11
    gatsby-remark-copy-linked-files: ^2.0.6 => 2.0.6
    gatsby-remark-images: ^2.0.6 => 2.0.6
    gatsby-remark-prismjs: ^3.0.3 => 3.0.3
    gatsby-remark-responsive-iframe: ^2.0.6 => 2.0.6
    gatsby-source-filesystem: ^2.0.7 => 2.0.8
    gatsby-transformer-remark: ^2.1.11 => 2.1.12
    gatsby-transformer-sharp: ^2.1.8 => 2.1.8

i get the following when running gatsby develop

success open and validate gatsby-configs β€” 0.010 s
    success load plugins β€” 0.359 s
    success onPreInit β€” 3.155 s
    success delete html and css files from previous builds β€” 0.075 s
    success initialize cache β€” 0.009 s
    success copy gatsby files β€” 0.224 s
    success onPreBootstrap β€” 0.016 s
    success source and transform nodes β€” 0.196 s
    success building schema β€” 0.549 s
    success createPages β€” 0.108 s
    success createPagesStatefully β€” 0.100 s
    success onPreExtractQueries β€” 0.007 s
    success update schema β€” 0.295 s
    success extract queries from components β€” 0.249 s
    success run graphql queries β€” 0.202 s β€” 9/9 44.76 queries/second
    success write out page data β€” 0.041 s
    success write out redirect data β€” 0.005 s
    success onPostBootstrap β€” 0.003 s

info bootstrap finished - 15.431 s

 DONE  Compiled successfully in 9836ms

You can now view k-legrand.com in the browser.

  http://localhost:8000/

View GraphiQL, an in-browser IDE, to explore your site's data and schema

  http://localhost:8000/___graphql

Note that the development build is not optimized.
To create a production build, use gatsby build

i ο½’wdmο½£:
i ο½’wdmο½£: Compiled successfully.

i'm currenty updating yarn and node to the latest stable releases and see if anything changes and report back to you

@Manoz re-ran it same output. It compiled without issues, booted a vm running ubuntu 18.04 same result, no issues reported. Sorry that i could not help out more

@jonniebigodes Hum thanks for your time anyway :)
Will wait :/

@Manoz as that issue has been making my head scratch for a bit...so i've put on my detective hat and big boy pants (pardon the bad pun) and went digging. So it finds out that particular error is thrown when the schema is being built. And by schema i mean when gatsby is getting the items needed (pages/components/graphql/directories/plugins) and so forth and then checks if the data structure is created is ok and filled with content. If it's not that error is thrown otherwise it will make another check and if that passes it will go about it's business on the build process. For my meager knowledge what might happen is that on your work computer you might have some diferences with plugin versions or any other diferent configurations with some plugins installed or paths that might be the culprits for that particular error. But some more knowledgeable can help you out further

Hum sounds fun :D
I tried on another laptop with a fresh install of Ubuntu. Same issue :/

I’ll dig more tonight. I saw some weird stuff inside npm logs. It’s like if MarkdownRemark doesn’t have everything to build the content. I copy/paste the log in few hours.

There you go, here's some more logs :/
https://pastebin.com/55RWhE7g

EDIT: more notes about this.

When running gatsby develop I have 2 warnings:

success open and validate gatsby-configs β€” 0.018 s
success load plugins β€” 0.677 s
success onPreInit β€” 0.012 s
success delete html and css files from previous builds β€” 0.009 s
success initialize cache β€” 0.029 s
success copy gatsby files β€” 0.057 s
success onPreBootstrap β€” 0.001 s
warning The internal-data-bridge plugin has generated no Gatsby nodes. Do you need it?
warning The gatsby-source-filesystem plugin has generated no Gatsby nodes. Do you need it?
success source and transform nodes β€” 0.002 s

If I comment the !_.isEmpty(nodes) in /node_modules/gatsby/dist/schema/index.js (for science), I have more details on the node error:

success onPreExtractQueries β€” 0.000 s
success update schema β€” 0.001 s
GraphQL Error There was an error while compiling your site's GraphQL queries.
  Error: Type Query must define one or more fields.

success extract queries from components β€” 0.035 s
success run graphql queries β€” 0.001 s
success write out page data β€” 0.020 s
success write out redirect data β€” 0.001 s
success onPostBootstrap β€” 0.001 s

I got this exact problem on a fresh gatsby install:

  • Ubuntu 18.04.1 LTS.
  • gatsby 2.4.8
  • npm 6.7.0
  • node 11.8.0

I initially got this error with older versions, then updated everything to the last stable release. After an hour trying to find the problem, I found it was the name of the folder, which contained [ and ]. This seems to cause an error with the way gatsby parses the paths. I don't know if this is a bug or it is intended not to allow the user to use those characters. In any case, this behaviour is quite annoying if you have no idea whatsoever about what's causing it.

@SAGGameDeveloper if that's the case, then @Manoz for instance which has the content inside a folder with the following way `dd-mm-yyy also doesn't work for him, but for me it does, on either case, i.e: linux on wsl and win 10. Also if that's the case, the library not allowing special characters of combinations of characters, then the plugin should throw the appropriate message in the error not a generic one.

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

Hey again!

It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it.

Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else.

Thanks again for being part of the Gatsby community!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  Β·  3Comments

andykais picture andykais  Β·  3Comments

benstr picture benstr  Β·  3Comments

mikestopcontinues picture mikestopcontinues  Β·  3Comments

3CordGuy picture 3CordGuy  Β·  3Comments