Cannot read properties of null (reading 'insertBefore')

Author: alamhubbCreated Dec 2, 2022Updated Dec 2, 2022

index.ts?t=1670014912902:50 Uncaught TypeError: Cannot read properties of null (reading 'insertBefore') at insert (index.ts?t=1670014912902:50:10) at mountElement (renderer.ts?t=1670014912902:243:5) at processElement (renderer.ts?t=1670014912902:63:7) at patch (renderer.ts?t=1670014912902:35:11) at ReactiveEffect.componentUpdateFn [as fn] (renderer.ts?t=1670014912902:295:9) at ReactiveEffect.run (effect.ts:23:25) at effect (effect.ts:47:11) at setupRenderEffect (renderer.ts?t=1670014912902:319:23) at mountComponent (renderer.ts?t=1670014912902:282:5) at processComponent (renderer.ts?t=1670014912902:256:7)

main.js

const rootContainer = document.querySelector("#root");

index.html

<div id="app"></div>

id不匹配导致,错误信息不友好