Skip to content
This repository has been archived by the owner on Dec 5, 2021. It is now read-only.

Cannot read property '$options' of undefined #85

Open
ghost opened this issue Nov 6, 2020 · 7 comments
Open

Cannot read property '$options' of undefined #85

ghost opened this issue Nov 6, 2020 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@ghost
Copy link

ghost commented Nov 6, 2020

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?

@ceilfors
Copy link

ceilfors commented Nov 9, 2020

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.

@TiagoDanin TiagoDanin added bug Something isn't working help wanted Extra attention is needed labels Nov 14, 2020
@TiagoDanin
Copy link
Owner

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.

nuxt/nuxt#8170

@TiagoDanin TiagoDanin self-assigned this Nov 14, 2020
@ghost
Copy link
Author

ghost commented Nov 14, 2020

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 ' atlas-pio@outlook.com '.
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.

@TiagoDanin
Copy link
Owner

Done in version 1.5.0

@TiagoDanin TiagoDanin removed the help wanted Extra attention is needed label Nov 14, 2020
@ceilfors
Copy link

Tested and works against nuxt 2.14.0.

@b-m-9
Copy link

b-m-9 commented Dec 10, 2020

"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 ()
at module.exports../.nuxt/server.js.webpack_exports.default (.nuxt/server.js:254:0)

@TiagoDanin
Copy link
Owner

#109

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants