ueberdosis/tiptap · error · Error
generateJSON can only be used in a Node environment If you w
Error message
generateJSON 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 "generateJSON 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/generateJSON.ts:29
* @param {ParseOptions} options - The options to be supplied to the parser.
* @returns {Promise<Record<string, any>>} - A promise with the generated JSON object.
* @example
* const html = '<p>Hello, world!</p>'
* const extensions = [...]
* const json = generateJSON(html, extensions)
* console.log(json) // { type: 'doc', content: [{ type: 'paragraph', content: [{ type: 'text', text: 'Hello, world!' }] }] }
*/
export function generateJSON(
html: string,
extensions: Extensions,
options?: ParseOptions,
): Record<string, any> {
// 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(
'generateJSON 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 localWindow = new Window({
settings: {
disableJavaScriptEvaluation: true,
disableJavaScriptFileLoading: true,
disableCSSFileLoading: true,
disableIframePageLoading: true,
disableComputedStyleRendering: true,
},
})
const localDOMParser = new localWindow.DOMParser()
let result: Record<string, any>
try {
const schema = getSchema(extensions)View on GitHub (pinned to 496d53afd7)
When it happens
Trigger: Thrown at packages/html/src/server/generateJSON.ts:29 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/c85f524053ba1a18.
Report an issue: GitHub.