I’m making a website, and wan’t to add SEO meta to my site. I have installed the @frontity/head-tags package, included it in the packages. I have installed the Frontity head plugin in wp, and Yoast seo. With all this installed, the site is unreachable(Internal Server Error). The error in the terminal is:
TypeError: Cannot read property 'add' of undefined
at t.r.init (webpack-internal:///./node_modules/@frontity/head-tags/node_modules/react-helmet-async/lib/index.module.js:14:9540)
at t.r.render (webpack-internal:///./node_modules/@frontity/head-tags/node_modules/react-helmet-async/lib/index.module.js:14:9603)
at processChild (webpack-internal:///./node_modules/react-dom/cjs/react-dom-server.node.development.js:402:631)
at resolve (webpack-internal:///./node_modules/react-dom/cjs/react-dom-server.node.development.js:396:122)
at ReactDOMServerRenderer.render (webpack-internal:///./node_modules/react-dom/cjs/react-dom-server.node.development.js:433:1199)
at ReactDOMServerRenderer.read (webpack-internal:///./node_modules/react-dom/cjs/react-dom-server.node.development.js:433:55)
at renderToString (webpack-internal:///./node_modules/react-dom/cjs/react-dom-server.node.development.js:470:116)
at eval (webpack-internal:///./node_modules/@frontity/core/src/server/index.tsx:68:243)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at eval (webpack-internal:///./node_modules/koa-mount/index.js:16:290)
If I remove the @frontity/head-tags from packages, the site works, when I add it back, the site breaks again with the same error. I also tried to install @frontity/yoast, but I get the same error.
Sorry to hear that you’re experiencing this problem. Try deleting the node_modules folders in the project root and the local packages (e.g. your theme). Also delete the package-lock.json files in the same locations. Then try running npm install again.
I deleted the node_modules and the package-lock.json. Also removed @frontity/head-tags from the package.json. Then I ran npm install, and then npm install @frontity/head-tags, and now it works.
I did not want to delete the theme, because I am almost done with the site. Luckily I didn’t have to.
Great - glad it now works. I didn’t mean delete the theme, I meant delete node_modules and package-lock.json from the local packages which might include the theme.
The site looks fantastic. Great work - congratulations. Have you considered submitting it to our showcases page?
Thanks for the kind words, but the JS Nation tutorial has been superseded by our recently published step-by-step tutorial. We would now recommend this as the best resource for learning to develop websites with Frontity.