{"record":{"id":"833f1e917b83adfd","repo":"ueberdosis/tiptap","slug":"generatehtml-can-only-be-used-in-a-node-environmen","errorCode":null,"errorMessage":"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.","messagePattern":"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\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/html/src/server/generateHTML.ts","lineNumber":25,"sourceCode":" * This function generates HTML from a ProseMirror JSON content object.\n *\n * @remarks **Important**: This function requires `happy-dom` to be installed in your project.\n * @param doc - The ProseMirror JSON content object.\n * @param extensions - The Tiptap extensions used to build the schema.\n * @returns The generated HTML string.\n * @example\n * ```js\n * const html = generateHTML(doc, extensions)\n * console.log(html)\n * ```\n */\nexport function generateHTML(doc: JSONContent, extensions: Extensions): string {\n  // Use positive Node.js detection to allow for jsdom/happy-dom environments in tests\n  const isNode =\n    typeof process !== 'undefined' && process.versions != null && process.versions.node != null\n\n  if (!isNode) {\n    throw new Error(\n      '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.',\n    )\n  }\n\n  const schema = getSchema(extensions)\n  const contentNode = PMNode.fromJSON(schema, doc)\n\n  return getHTMLFromFragment(contentNode, schema)\n}\n","sourceCodeStart":7,"sourceCodeEnd":35,"githubUrl":"https://github.com/ueberdosis/tiptap/blob/496d53afd7e4e3c7424b4749adeff4f45e27ddb0/packages/html/src/server/generateHTML.ts#L7-L35","documentation":"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.\" thrown in ueberdosis/tiptap.","triggerScenarios":"Thrown at packages/html/src/server/generateHTML.ts:25 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"496d53afd7e4e3c7424b4749adeff4f45e27ddb0","analyzedAt":"2026-08-26T22:41:43.400Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}