gatsby: "registerPreviewStyle" error with gatsby-plugin-netlify-cms

Description

The latest gatsby-plugin-netlify-cms doesn’t seem to work with the latest netlify-cms.

Steps to reproduce

Install gatsby-plugin-netlify-cms@3.0.0-rc.1 and netlify-cms@2.8.0 and load up the /admin/ page.

Expected result

User should see the admin page with no console errors

Actual result

A blank screen with the following error is seen when loading up the Netlify CMS admin page:

cms.js:10 Uncaught TypeError: Cannot read property 'registerPreviewStyle' of undefined
    at Object.<anonymous> (cms.js:10)
    at __webpack_require__ (bootstrap:19)
    at Object.<anonymous> (bootstrap:83)
    at __webpack_require__ (bootstrap:19)
    at bootstrap:83
    at bootstrap:83

Environment

  System:
    OS: macOS High Sierra 10.13.6
    CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 11.6.0 - /var/folders/qv/2cfwn7m13jb4rpxhm9trf1yczc9jvk/T/yarn--1553291763090-0.49216429764230507/node
    Yarn: 1.13.0 - /var/folders/qv/2cfwn7m13jb4rpxhm9trf1yczc9jvk/T/yarn--1553291763090-0.49216429764230507/yarn
    npm: 6.5.0-next.0 - ~/.nvm/versions/node/v11.6.0/bin/npm
  Languages:
    Python: 2.7.15 - /usr/local/bin/python
  Browsers:
    Chrome: 73.0.3683.86
    Firefox: 55.0.3
    Safari: 11.1.2
  npmPackages:
    gatsby: ^2.2.0 => 2.2.0 
    gatsby-image: ^2.0.0-rc.1 => 2.0.34 
    gatsby-link: ^2.0.0-rc.2 => 2.0.16 
    gatsby-plugin-canonical-urls: ^2.0.0-rc.1 => 2.0.12 
    gatsby-plugin-emotion: ^4.0.1 => 4.0.6 
    gatsby-plugin-esca-css: ^1.0.3 => 1.0.3 
    gatsby-plugin-favicon: ^3.1.4 => 3.1.5 
    gatsby-plugin-feed: ^2.0.8 => 2.0.15 
    gatsby-plugin-google-analytics: ^2.0.0-rc.1 => 2.0.17 
    gatsby-plugin-google-fonts: ^0.0.4 => 0.0.4 
    gatsby-plugin-netlify: ^2.0.0-rc.2 => 2.0.13 
    gatsby-plugin-netlify-cms: ^3.0.0-rc.1 => 3.0.16 
    gatsby-plugin-netlify-cms-paths: ^1.0.1 => 1.2.1 
    gatsby-plugin-polyfill-io: ^1.0.5 => 1.1.0 
    gatsby-plugin-prefetch-google-fonts: ^1.2.0 => 1.4.0 
    gatsby-plugin-react-helmet: ^3.0.10 => 3.0.10 
    gatsby-plugin-remove-trailing-slashes: ^2.0.0-rc.1 => 2.0.10 
    gatsby-plugin-robots-txt: ^1.3.0 => 1.4.0 
    gatsby-plugin-sharp: ^2.0.0-rc.3 => 2.0.29 
    gatsby-plugin-sitemap: ^2.0.10 => 2.0.10 
    gatsby-plugin-webpack-size: ^0.0.3 => 0.0.3 
    gatsby-remark-copy-linked-files: ^2.0.0-rc.1 => 2.0.11 
    gatsby-remark-external-links: ^0.0.4 => 0.0.4 
    gatsby-remark-images: ^3.0.1 => 3.0.10 
    gatsby-remark-smartypants: ^2.0.0-rc.1 => 2.0.9 
    gatsby-source-filesystem: ^2.0.1-rc.1 => 2.0.27 
    gatsby-transformer-remark: ^2.3.6 => 2.3.6 
    gatsby-transformer-sharp: ^2.1.1-rc.2 => 2.1.17 

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 4
  • Comments: 20 (13 by maintainers)

Most upvoted comments

I will be working on this issue with @erquhart (Shawn). We should have it all stable as soon as possible. Please downgrade the netlify-cms version until we get a beta released to test against. We may be making changes to the plugin also and will notify here. Thanks for your patience on this.

yes, can confirm that downgrading to netlify-cms@2.6.0 helped. I am also using netlify-cms-backend-fs for local development, which I accidentally bumped to 0.4.x (not compatible with netlify.cms@2.6.0) … netlify-cms-backend-fs@0.3.3 works fine though.

@talves, I’ve tested this and version 2.9 works! Thanks a bunch, hopefully we can get your other PR in too.

@talves @kennedyrose I did a quick check just now, and can confirm it works in my setup with 2.8.1-beta.1 👍

The devtools console reports the following versions in use (running dev mode):

netlify-cms 2.8.1-beta.1
netlify-cms-core 2.10.1-beta.1