question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[worker] definePageMeta is not defined

See original GitHub issue

Environment

  • Operating System: Darwin
  • Node Version: v16.13.1
  • Nuxt Version: 3.0.0-27385496.7a1cf62
  • Package Manager: yarn@1.22.17
  • Bundler: Vite
  • User Config: head, css, build
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://codesandbox.io/s/hardcore-grass-965dh?file=/pages/index.vue

Describe the bug

Instructions from official Nuxt3 tutorial can’t be executed image

Additional context

Check out this topic: https://github.com/nuxt/framework/discussions/2770

Any of flows:

  1. Having ‘pages’ folder and no lock.json/node_modules -> installing -> running (after clone)
  2. Having ‘pages’ folder, deleting lock.json/node_modules -> installing -> running
  3. Having no pages folder (e.g no vue-router) will result in lack of definePageMeta

In this example I use definePageMeta for middleware, but it doesn’t depend on it (this is not the source of the error) I do get the following warning though:

[Vue warn]: Unhandled error during execution of setup function at <Index onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< undefined > key=“/some_page” > definePageMeta is not defined at setup (file://./.nuxt/dist/server/server.mjs:11102:1)

Logs

ERROR  [worker] definePageMeta is not defined                                                                          

  at setup (.nuxt/dist/server/server.mjs:11102:1)
  at _sfc_main.setup (.nuxt/dist/server/server.mjs:11491:23)
  at callWithErrorHandling (node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:6621:22)
  at setupStatefulComponent (node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:6247:29)
  at setupComponent (node_modules/@vue/runtime-core/dist/runtime-core.cjs.js:6203:11)
  at renderComponentVNode (node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:198:17)
  at renderVNode (node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:304:22)
  at renderVNode (node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:310:17)
  at renderComponentSubTree (node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:269:13)
  at renderComponentVNode (node_modules/@vue/server-renderer/dist/server-renderer.cjs.js:214:16)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
danielroecommented, Feb 11, 2022

I’m going to close this issue. We’ve implemented a helper in Nuxi to clear the vite cache (which was the likely culprit) automatically on upgrade.

If anyone experiences this in future, even after trying the steps above, please create a new issue with a reproduction.

2reactions
edencommented, Feb 11, 2022

I would suggest deleting your node_modules/.vite and node_modules/.cache folders. Also try upgrading with npx nuxi upgrade --force.

I encountered this issue in my project, but completely removing node_modules and reinstalling from NPM from scratch fixed everything.

Read more comments on GitHub >

github_iconTop Results From Across the Web

vuepress build docs get ReferenceError: pageMeta is not ...
tl;dr You need to downgrade vue-router which is installed as part of vuepress to match ~3.1.3. I've basically encountered the same error ...
Read more >
layouts/ · Nuxt Directory Structure
Nuxt provides a layouts framework to extract common UI patterns into reusable layouts.
Read more >
nuxt3 definePageMeta no update - CodeSandbox
Sign up for free to save your work0/3 Sandboxes used - Anonymous. CodeSandbox. nuxt3 definePageMeta no update. 0. Embed Fork Create Sandbox Sign...
Read more >
Understanding the Directory structure in Nuxt 3 - Vue School
It is also required that you do not touch files in this directory when ... work in both `<script setup>` and `<script>` definePageMeta({ ......
Read more >
Documentation · Nuxt Color Mode
When $colorMode.preference is set to 'system' , using $colorMode in your Vue ... If you are using Nuxt Bridge, you should not use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found