ueberdosis/tiptap · error · Error
generateHTML can only be used in a Node environment If you w
Error message
generateHTML can only be used in a Node environment If you want to use this in a browser environment, use the `@tiptap/html` import instead.
What it means
Error "generateHTML can only be used in a Node environment If you want to use this in a browser environment, use the `@tiptap/html` import instead." thrown in ueberdosis/tiptap.
Source
Thrown at packages/html/src/server/generateHTML.ts:25
* This function generates HTML from a ProseMirror JSON content object.
*
* @remarks **Important**: This function requires `happy-dom` to be installed in your project.
* @param doc - The ProseMirror JSON content object.
* @param extensions - The Tiptap extensions used to build the schema.
* @returns The generated HTML string.
* @example
* ```js
* const html = generateHTML(doc, extensions)
* console.log(html)
* ```
*/
export function generateHTML(doc: JSONContent, extensions: Extensions): string {
// Use positive Node.js detection to allow for jsdom/happy-dom environments in tests
const isNode =
typeof process !== 'undefined' && process.versions != null && process.versions.node != null
if (!isNode) {
throw new Error(
'generateHTML can only be used in a Node environment\nIf you want to use this in a browser environment, use the `@tiptap/html` import instead.',
)
}
const schema = getSchema(extensions)
const contentNode = PMNode.fromJSON(schema, doc)
return getHTMLFromFragment(contentNode, schema)
}
View on GitHub (pinned to 496d53afd7)
When it happens
Trigger: Thrown at packages/html/src/server/generateHTML.ts:25 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of ueberdosis/tiptap@496d53afd7 (2026-08-26).
Data as JSON: /api/errors/833f1e917b83adfd.
Report an issue: GitHub.