0

I created a Gutenberg block plugin on one computer in a local site using create-guten-block. It works fine.

I'm trying to copy/move it to a different Wordpress install on another computer, and no matter the method I try I always wind up with

This block has encountered an error and cannot be previewed.

I created a Git repo out of the plugin on computer 1 and created a repo on Github and pushed it.

I cloned the repo into the plugins directory on computer 2, ran npm i, even tried npm run build and npm start (which all ran without a hitch), but the block does not load in the post editor. It just loads with the error above.

I've even tried going from computer 2 to computer 1 with a different block, same thing.

Is there no way to develop blocks on 2 different machines via a git repo, which is how I develop everything else (such as themes)? What am I missing here?

edit: the react error in the console is

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined.

Note this block works perfectly on computer 1.

  • 1
    Are you copying the block? Or the plugin? Or both? You will need both for it to work as expected. Did you raise an issue on GH? While GB is not offtopic here, it isn't the best place to ask questions, your chances of getting an answer on the Gutenberg GitHub are 1000x higher. Also are you sure both sites are running identical content and identical versions of GB? I also can't help but notice you never import React or React dom stuff in your JSX. It's also note clear from the error message provided which component was undefined, perhaps the react dev tools will help? – Tom J Nowell Jun 22 '18 at 16:27

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.