vue-meta
vue-meta copied to clipboard
[Version ^3.0.0-alpha.2] Cannot read property 'resolve' of undefined with Vue3 in SSR mode
Hello,
I'm trying to make work vue-meta with Vue3 in SSR mode (https://github.com/nuxt/vue-meta/tree/next#ssr)
Everything build just fine, I can start my express server and all but when I'm accessing a page I'm getting this error:
[Vue warn]: Unhandled error during execution of setup function
at <App>
(node:24140) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'resolve' of undefined
at Object.resolve (F:\Documents\website\node_modules\vue-meta\dist\vue-meta.cjs.js:845:25)
at recompute (F:\Documents\website\node_modules\vue-meta\dist\vue-meta.cjs.js:274:32)
at compute (F:\Documents\website\node_modules\vue-meta\dist\vue-meta.cjs.js:434:27)
at Object.addSource (F:\Documents\website\node_modules\vue-meta\dist\vue-meta.cjs.js:441:17)
at MetaManager.addMeta (F:\Documents\website\node_modules\vue-meta\dist\vue-meta.cjs.js:757:34)
at useMeta (F:\Documents\website\node_modules\vue-meta\dist\vue-meta.cjs.js:691:31)
at setup (F:\Documents\website\dist\server\js\app.514800de.js:1622:42)
at callWithErrorHandling (F:\Documents\website\node_modules\@vue\runtime-core\dist\runtime-core.cjs.js:6919:22)
at setupStatefulComponent (F:\Documents\website\node_modules\@vue\runtime-core\dist\runtime-core.cjs.js:6537:29)
at setupComponent (F:\Documents\website\node_modules\@vue\runtime-core\dist\runtime-core.cjs.js:6493:11)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:24140) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:24140) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
This line trigger the error in vue-meta.cjs.js:

I tried to add the metaManager in the context (in case of):

Inside the createApp function there is nothing special :

And here is my App.vue file where the error is triggered :

(Do not pay attention to the extra console.log I was checking that nothing was undefined.)
Does someone have an idea about what is going wrong here? 😕
Thank you.
bump
Same here
same
same issue here without the SSR
Me too. Did anyone find a workaround for this?
This error will go away if you use v3.0.0-alpha.10 but I still can't get vue-meta to work in a brand new project regardless.
Same here
Thanks for your contribution to vue-meta! This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you would like this issue to remain open:
- Verify that you can still reproduce the issue in the latest version of vue-meta
- Comment the steps to reproduce it
Issues that are labeled as
pendingwill not be automatically marked as stale.
Same here.
same here
Same here
same here
same here
same heve for a vite + vue 3 environment.
same
SAme
same for vie + vue 3
same here vite+vue3
I think I've found the source of the problem, as well as the solution:
TL;DR: Verify that you've got the correct version of the vue-meta package installed in your project.
For some reason, when you run the npm install vue-meta@next --save command (as instructed by the docs from the homepage), the NPM installs the vue-meta package with the version set to ^3.0.0-alpha.2. However, when you look at the Releases page, it's obvious that the newest release is 3.0.0-alpha.8. Given this information, when you manually set the package version in the package.json to ^3.0.0-alpha.8 and run the npm install command, the problem goes away; NPM updates the vue-meta package, and the createMetaManager() function behaves as expected 🙂
CC: @pimlie ('cause you seem to maintain the README.md file for the next branch)
I think I've found the source of the problem, as well as the solution:
TL;DR: Verify that you've got the correct version of the
vue-metapackage installed in your project.For some reason, when you run the
npm install vue-meta@next --savecommand (as instructed by the docs from the homepage), the NPM installs thevue-metapackage with the version set to^3.0.0-alpha.2. However, when you look at the Releases page, it's obvious that the newest release is3.0.0-alpha.8. Given this information, when you manually set the package version in thepackage.jsonto^3.0.0-alpha.8and run thenpm installcommand, the problem goes away; NPM updates thevue-metapackage, and thecreateMetaManager()function behaves as expected 🙂CC: @pimlie ('cause you seem to maintain the
README.mdfile for thenextbranch)
@staszek998 this fixes the problem. Indeed npm install vue-meta@next is installing alpha.2