Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: window.__setPreferredTheme is not a function #2

Open
kiku511 opened this issue Mar 16, 2019 · 6 comments
Open

TypeError: window.__setPreferredTheme is not a function #2

kiku511 opened this issue Mar 16, 2019 · 6 comments

Comments

@kiku511
Copy link

kiku511 commented Mar 16, 2019

Steps to reproduce:

  1. gatsby new gatsby-blog
  2. npm install gatsby-plugin-dark-mode
  3. Copied the ThemeToggler code from documentation.
  4. Added Component to index.js
  5. Clicking on the generated checkbox produces error.
@kiku511
Copy link
Author

kiku511 commented Mar 16, 2019

File:

toggleTheme
node_modules/gatsby-plugin-dark-mode/ThemeToggler.js:54

@SleeplessByte
Copy link

Did you forget to include the plugin in your gatsby-config.js?

@SpacemanPete
Copy link

I got the same error. Restarting my local dev server fixed it for me.

@ethernal
Copy link

Sadly I have the same issue:

  1. restarted dev server,
  2. removed options from plugin initialization,
  3. cleared cache and started server again.

Still the same, crashes when clicking the checkbox.

@twanmulder
Copy link

twanmulder commented May 3, 2020

I had the same error, but it was fixed by adding "--save" to the npm command.
So to install the plugin, I used:

npm install gatsby-plugin-dark-mode --save

@muhammedMoussa
Copy link

Did you forget to include the plugin in your gatsby-config.js?

yeah, this works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants