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.

using useHead() in pages fails in ssg build step

See original GitHub issue

Hi there,

i couldnt find an answer in the example here, docs or elsewhere in the vite-ssg. trying my luck here as i think it may be related to “file based routing” ???

i am using useHead() in a page’s <script setup> section. on build for server step i get this error:

.vite-ssg-temp/main.js                     545.77 KiB
Error: You may forget to apply app.use(head)
    at injectHead (.../node_modules/.pnpm/@vueuse+head@0.7.2_vue@3.2.22/node_modules/@vueuse/head/dist/index.js:127:11)
    at Object.useHead (.../node_modules/.pnpm/@vueuse+head@0.7.2_vue@3.2.22/node_modules/@vueuse/head/dist/index.js:317:16)
    at Module.<anonymous> (.../.vite-ssg-temp/main.js:9872:6)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at build (.../node_modules/.pnpm/vite-ssg@0.15.6_387c7a65fb810fc8b5f7093a45d54150/node_modules/vite-ssg/dist/node/cli.js:172:52)
 ELIFECYCLE  Command failed with exit code 1.

am i doing it wrong or just misusing the functionality? the usage in App.vue succeeds.

appreciate any pointers. will submit a docs PR if i find a solution. thanks, C

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

3reactions
maxweldcommented, Nov 23, 2021

Probably related, I am getting the following dependency issue when running ‘npm install’ after a fresh download (degit).

npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: undefined@undefined npm ERR! Found: @vueuse/head@0.6.0 npm ERR! node_modules/@vueuse/head npm ERR! @vueuse/head@“^0.6.0” from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer @vueuse/head@“^0.5.1” from vite-ssg@0.15.6 npm ERR! node_modules/vite-ssg npm ERR! dev vite-ssg@“^0.15.6” from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force, or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

1reaction
maxweldcommented, Nov 24, 2021

I was using npm, not pnpm.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vite SSG: Static Site Generation for Vue 3 on Vite - Morioh
I would like to share with you how to generate xlsx file in python. I explained simply step by step how to create...
Read more >
Next.js is not building page as SSG when it should
Let's take my 404 page that uses getStaticProps to fetch data from prismic with graphql. It is being rendered as a Static website...
Read more >
V - Static Site Generation and Server-Side Rendering Using Next.js ...
Static Site Generation, or SSG, on the other hand, means that pages' HTML is generated at build time once. So, technically it means...
Read more >
How to Configure SSG and SSR on Nuxt.js - Mad Devs
Storing; SSG; SSR. Separately, I will show you how to set up SSG, SSR in production and create your own API using nuxt...
Read more >
Implementing SSR in Next.js: Dynamic routing and prefetching
This means every page will use static site generation by default, one of the two ... Your first step is creating an Agility...
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