Gatsby: scheduler.development.js:107 Uncaught TypeError: callback is not a function

Created on 18 Sep 2019  ·  8Comments  ·  Source: gatsbyjs/gatsby

Description

callback is not a function when update gatsby related packages and react to latest.

Steps to reproduce

repositories: https://github.com/FengShangWuQi/fengshangwuqi.github.io

1、npm run check // update all packages to latest
2、npm start // start project

Expected result

open page with no error

Actual result

callback is not a function

Environment

  System:
    OS: macOS 10.14.6
    CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 10.16.3 - /usr/local/bin/node
    npm: 6.11.3 - /usr/local/bin/npm
  Languages:
    Python: 2.7.10 - /usr/bin/python
  Browsers:
    Chrome: 76.0.3809.132
    Safari: 12.1.2
  npmPackages:
    gatsby: 2.15.16 => 2.15.16 
    gatsby-image: 2.2.19 => 2.2.19 
    gatsby-plugin-emotion: 4.1.6 => 4.1.6 
    gatsby-plugin-feed: 2.3.12 => 2.3.12 
    gatsby-plugin-google-analytics: 2.1.16 => 2.1.16 
    gatsby-plugin-offline: 3.0.7 => 3.0.7 
    gatsby-plugin-page-creator: 2.1.17 => 2.1.17 
    gatsby-plugin-react-helmet: 3.1.7 => 3.1.7 
    gatsby-plugin-sharp: 2.2.22 => 2.2.22 
    gatsby-plugin-svgr: 2.0.2 => 2.0.2 
    gatsby-plugin-twitter: 2.1.6 => 2.1.6 
    gatsby-plugin-typescript: 2.1.8 => 2.1.8 
    gatsby-plugin-typography: 2.3.7 => 2.3.7 
    gatsby-remark-autolink-headers: 2.1.10 => 2.1.10 
    gatsby-remark-copy-linked-files: 2.1.19 => 2.1.19 
    gatsby-remark-emojis: 0.3.2 => 0.3.2 
    gatsby-remark-external-links: 0.0.4 => 0.0.4 
    gatsby-remark-images: 3.1.22 => 3.1.22 
    gatsby-remark-prismjs: 3.3.13 => 3.3.13 
    gatsby-remark-responsive-iframe: 2.2.16 => 2.2.16 
    gatsby-remark-smartypants: 2.1.8 => 2.1.8 
    gatsby-source-filesystem: 2.1.22 => 2.1.22 
    gatsby-transformer-remark: 2.6.22 => 2.6.22 
    gatsby-transformer-sharp: 2.2.14 => 2.2.14 
  npmGlobalPackages:
    gatsby-cli: 2.7.47

react

react: 16.9.0
react-dom: 16.9.0
needs reproduction bug

Most helpful comment

I got the same error while working locally (running gatsby develop):

Screenshot 2019-09-18 at 12 53 09

It was fixable by downgrading react & react-dom like this

react: 16.9.0 -> 16.8.6
react-dom: 16.9.0 -> 16.8.6

I'm not 100% sure, but it might be because of a mismatch in scheduler versions (like the error page suggests), e.g. running npm list scheduler w/ react & react-dom upgraded resulted in this:
Screenshot 2019-09-18 at 12 48 46

And after downgrading, they matched again:
Screenshot 2019-09-18 at 12 46 38

All 8 comments

Could you please post the complete error message you're getting?

I got the same error while working locally (running gatsby develop):

Screenshot 2019-09-18 at 12 53 09

It was fixable by downgrading react & react-dom like this

react: 16.9.0 -> 16.8.6
react-dom: 16.9.0 -> 16.8.6

I'm not 100% sure, but it might be because of a mismatch in scheduler versions (like the error page suggests), e.g. running npm list scheduler w/ react & react-dom upgraded resulted in this:
Screenshot 2019-09-18 at 12 48 46

And after downgrading, they matched again:
Screenshot 2019-09-18 at 12 46 38

By recreating this issue locally, I found that (for my project) this only happens after upgrading react-dom to 16.9.0

react: 16.9.0
react-dom: 16.8.6

doesn't create this issue

@thomascorthouts thanks so much, really appreciated. I also learned how to resolve dependency problem such like this. thanks again.

Hey @FengShangWuQi

Nice to hear this fixed the issue for you, I'm going to reopen the issue as it is something Gatsby needs to be aware of as it raises the question of how we want to fix this. e.g. setting a specific peer dependency version vs. upgrading the scheduler in gatsby-cli.
Maybe @wardpeet knows whether this is on the short-term planning for the team (Sorry Ward if you weren't the person to drag in) I'd be fine with helping to resolve this issue in general, I would just need to know what the preferred approach would be.

I find some thing interesting, mismatch of scheduler versions is also appears in gatsby-starter-default project, but gatsby-starter-default works well.

Before we can move to next steps we'd need a minimal reproduction of the problem first :)

This issue is resolved in the newest version of Gatsby & Gatsby CLI.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ferMartz picture ferMartz  ·  3Comments

ghost picture ghost  ·  3Comments

Oppenheimer1 picture Oppenheimer1  ·  3Comments

signalwerk picture signalwerk  ·  3Comments

brandonmp picture brandonmp  ·  3Comments