Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: [vite-ssg] Error on page: ReferenceError: window is not defined #417

Open
5 of 7 tasks
luizgringo opened this issue Aug 29, 2024 · 0 comments
Open
5 of 7 tasks

Comments

@luizgringo
Copy link

Describe the bug

I tried to use pnpm build using vite-ssg build and received this error:

[vite-ssg] Build for server...
vite v5.4.1 building SSR bundle for production...
✓ 54 modules transformed.
.vite-ssg-temp/3gs38p19w8/assets/style-ChH4TTz9.css   6.44 kB
.vite-ssg-temp/3gs38p19w8/main.mjs                   81.44 kB
✓ built in 685ms

[vite-ssg] Rendering Pages... (1)
file:///Users/etus_0128/Desktop/Projetos/quizmaker/frontend/node_modules/.pnpm/[email protected][email protected]_@[email protected][email protected][email protected][email protected][email protected]_/node_modules/vite-ssg/dist/node.mjs:1058
        throw new Error(`${gray("[vite-ssg]")} ${red(`Error on page: ${cyan(route)}`)}
              ^

Error: [vite-ssg] Error on page: /
ReferenceError: window is not defined
    at file:///Users/etus_0128/Desktop/Projetos/quizmaker/frontend/.vite-ssg-temp/3gs38p19w8/main.mjs:2056:7
    at ReactiveEffect.fn (/Users/etus_0128/Desktop/Projetos/quizmaker/frontend/node_modules/.pnpm/@[email protected]/node_modules/@vue/reactivity/dist/reactivity.cjs.prod.js:928:13)

I know that has #23 similar error and i tried all that sugestions but i couldnt solve this problem.

Somebody can help me with this issue?

Reproduction

Running vite-ssg build

System Info

System:
    OS: macOS 14.6.1
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Memory: 60.07 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.13.1 - /usr/local/bin/node
    Yarn: 1.22.21 - /usr/local/bin/yarn
    npm: 10.5.2 - /usr/local/bin/npm
    pnpm: 9.1.3 - ~/Library/pnpm/pnpm
  Browsers:
    Brave Browser: 127.1.68.134
    Chrome: 128.0.6613.86
    Safari: 17.6

Used Package Manager

pnpm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Contributions

  • I am willing to submit a PR to fix this issue
  • I am willing to submit a PR with failing tests (actually just go ahead and do it, thanks!)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant