react: scheduler callback is not a function

Do you want to request a feature or report a bug? Bug

What is the current behavior? After update react env from 16.8.6 -> 16.9.0 I catch errors:

scheduler.development.js:107 Uncaught TypeError: callback is not a function
    at flushFirstCallback (scheduler.development.js:107)
    at flushWork (scheduler.development.js:219)
    at MessagePort../node_modules/scheduler/cjs/scheduler.development.js.channel.port1.onmessage (scheduler.development.js:611)
flushFirstCallback @ scheduler.development.js:107
flushWork @ scheduler.development.js:219
./node_modules/scheduler/cjs/scheduler.development.js.channel.port1.onmessage @ scheduler.development.js:611

What is the expected behavior? No errors

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React? Version 16.9.0 On 16.8.6 all works fine

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 6
  • Comments: 20

Commits related to this issue

Most upvoted comments

For anybody having issues after deleting node_modules: Try verifying you only have a single scheduler entry in the lockfile of your package manager. For yarn use yarn why scheduler and for npm npm list scheduler. It should only list a single one. For yarn you can just remove all scheduler entries and run yarn again. This should result in a single entry. No idea about npm other than manually merging the entries.

Deleting both node_modules and package-lock.json (and then npm i) fixed it for me.

You probably forgot to update some of the packages. Ensure that you have 16.9.0 of both React and ReactDOM, for example. If this doesn’t help, try deleting node_modules and installing again.

deleted node_modules, updated react and react-dom to 16.9.0, still having this issue. I am running it inside the gatsby project.

Walking around that issue I finded solution for my case (thanks all who leave a comment here) and only add:

  1. if you have several versions of scheduler you can use with npm this
  2. in any case after each manipulation with scheduler ALWAYS reload you react app (e.g. npm start) Thanks to everybody!

Installing it explicitly at the top level is a bad idea and will only create more problems in the future, as the version you installed will get out of sync with the version used by React. Please don’t do that.

I have gatsby and react-dom installing two different versions of scheduler. npm install --save scheduler was the solution for my case.