Description
Describe the bug
build error:
ReferenceError: window is not defined
at file:///E:/docs/.vitepress/.temp/app.js?t=1741415492907:9826:3
at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
at async build (file:///E:/node_modules/.pnpm/vitepress@1.0.1_@algolia+client-search@4.20.0_@types[email protected][email protected]_axios_6jmcxapznl6bymfiwls65tjhl4/node_modules/vitepress/dist/node/serve-C_2bYS0g.js:46722:24)
ELIFECYCLE Command failed with exit code 1.
ELIFECYCLE Command failed with exit code 1.
Reproduction
VitePress is the most difficult tool I have ever used, because you don't even know where the error is coming from!
I can't tell where the error is. This project has tens of thousands of lines of code. How can I find it?
Expected behavior
Find the file with the error message
System Info
System:
OS: Windows 10 10.0.19045
CPU: (6) x64 Intel(R) Core(TM) i5-9400 CPU @ 2.90GHz
Memory: 15.36 GB / 31.94 GB
Binaries:
Node: 20.15.0 - C:\Program Files\nodejs\node.EXE
npm: 10.7.0 - C:\Program Files\nodejs\npm.CMD
pnpm: 9.14.2 - C:\Program Files\nodejs\pnpm.CMD
Browsers:
Chrome: bookmarks.html
initial_preferences
Edge: Spartan (44.19041.1266.0), Chromium (127.0.2651.74)
Internet Explorer: 11.0.19041.1566
Additional context
No response
Validations
- Check if you're on the latest VitePress version.
- Follow our Code of Conduct
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.