Skip to content

Fixing 'renderToPipeableStream is not a function' error in Gatsby

Published:

If you get the "renderToPipeableStream is not a function" error with your Gatsby v5 builds, you are probably using gatsby-plugin-preact. Here's the error in full:

failed Building static HTML for pages - 13.802s
ERROR #95313 HTML.COMPILATION
Building static HTML failed for path "/404/"
See our docs page for more info on this error: https://gatsby.dev/debug-html
WebpackError: TypeError: renderToPipeableStream is not a function

The error happens because Gatsby v5 has React 18 as its hard requirement, but at the moment Preact has not been updated for React 18. This unfortunately means that you must uninstall Preact from your project. I have had to do the same for multiple projects so far, and as painful as it is, it is currently the only way.

If you are not in fact using Preact, then some other package or Gatsby plugin might be still using some functions that React 18 does not use. If I were you, I would try removing packages one by one until you can find the cause for the renderToPipeableStream error.