nteract / notebook-render

3 stars 8 forks source link

Error: Renderer for type `element` not defined or is not renderable #1

Open ahojukka5 opened 4 years ago

ahojukka5 commented 4 years ago

All notebook rendering seems to return error.

const React = require("react")
const ReactDOMServer = require(`react-dom/server`)
const NotebookRender = require(`@nteract/notebook-render`).default
const notebook = {
  cells: [
    {
      cell_type: "markdown",
      metadata: {},
      source: ["Hello, world!"],
    },
  ],
  metadata: {
    kernelspec: {
      display_name: "Python 3",
      language: "python",
      name: "python3",
    },
    language_info: {
      codemirror_mode: {
        name: "ipython",
        version: 3,
      },
      file_extension: ".py",
      mimetype: "text/x-python",
      name: "python",
      nbconvert_exporter: "python",
      pygments_lexer: "ipython3",
      version: "3.7.3",
    },
  },
  nbformat: 4,
  nbformat_minor: 2,
}

const reactComponent = React.createElement(NotebookRender, { notebook }, null)
const html = ReactDOMServer.renderToStaticMarkup(reactComponent)

// => Error: Renderer for type `element` not defined or is not renderable
sdobz commented 4 years ago

@ahojukka5

If you have urgent need to continue development something similar to the following steps will probably help you out:

mkdir -p lib
cd lib
git clone https://github.com/sdobz/notebook-render
cd notebook-render
yarn
yarn build
yarn link
cd ../..
yarn link @nteract/notebook-render
ryanarmstrong commented 4 years ago

I'm having the same issue. @ahojukka5 did you ever find a solution?

eduardo-escoto commented 2 years ago

Sorry to revive this dead thread. But your suggestion fixed this issue, thanks so much @sdobz!