diff --git a/packages/@vuepress/core/lib/client/root-mixins/updateMeta.js b/packages/@vuepress/core/lib/client/root-mixins/updateMeta.js index eb9aebbf22..485f544d38 100644 --- a/packages/@vuepress/core/lib/client/root-mixins/updateMeta.js +++ b/packages/@vuepress/core/lib/client/root-mixins/updateMeta.js @@ -61,9 +61,9 @@ export default { */ function updateMetaTags (newMetaTags, currentMetaTags) { if (currentMetaTags) { - [...currentMetaTags].forEach(c => { - document.head.removeChild(c) - }) + [...currentMetaTags] + .filter(c => c.parentNode === document.head) + .forEach(c => document.head.removeChild(c)) } if (newMetaTags) { return newMetaTags.map(m => {