Nuxt-SEO
Nuxt-SEO copied to clipboard
Cannot read property '$options' of undefined
Hello. I'm getting this error when i've created a fresh nuxt js project with latest version of library
Cannot read property '$options' of undefined
.
async asyncData({ $axios,seo }) {
try {
const home = await $axios.$get('/home');
seo({
name: 'Atlas',
title: 'Home Page',
templateTitle: '%name% - %title%',
description: 'Hello World Page'
})
return {
home: home.responseData,
};
} catch (e) {
console.log(e)
}
},
when i was using '^1.3.1' version above code was working fine, now in newest version if i use above code, only seo details will be set, and i won't get my axios data to return home
but i also get above cannot read property '$options' of undefined
in console.
if i use head context i'll only get cannot read property '$options' of undefined
which app nuxt app gonna crush. this happen for other ways you mentioned in your examples.
api is also working fine, i tested above code with earlier version and it's worked. how to fix this?
I'm facing this issue as well. I have downgraded nuxt from 2.14.7 to 2.14.0 and the error has disappeared. Seems like there may be internal variables that Nuxt-SEO has used, but perhaps have been removed in the latest Nuxt.
A patch version (2.14.7) of nuxt has removed an extremely important context Vue.prototype.$nuxt
.
I will provide a fix as soon as possible.
https://github.com/nuxt/nuxt.js/pull/8170
Hey my friend. i'm currently editing my videos for a premium course in udemy which i'm introducing your package there, so if you could fix this issues in early, i can edit the record video again instead of commenting since there's a conflict with nuxt version.
you can also reach to me via email ' [email protected] '. edit process might take almost 1-2~ week since there are more than 35 parts, and i'll publish course after that so if you could fix this, i can record this again.
Best Regards, Good Luck.
Done in version 1.5.0
Tested and works against nuxt 2.14.0.
"nuxt": "2.14.11", "nuxt-seo": "1.5.0",
Cannot read property '$nuxt' of undefined 02:10:03
at create (.nuxt/Nuxt-Seo.js:185:0)
at asyncData (index.vue:98:0)
at promisify (.nuxt/utils.js:281:0)
at server.js:4472:82
at Array.map (
#109