vitepress
vitepress copied to clipboard
build:doc 打包报错:Error: ENOENT: no such file or directory
Describe the bug
打包详情如下:
正在执行任务: pnpm run docs:build
[email protected] docs:build D:\Code[MyProject][Docs]\ProgramLearnNotes vitepress build docs
vitepress v1.1.3
x Build failed in 1.71s ✖ building client + server bundles... node:internal/fs/promises:887 const result = await binding.lstat(pathModule.toNamespacedPath(path), ^
Error: ENOENT: no such file or directory, lstat at lstat (node:internal/fs/promises:887:32) at findFile (file:///D:/Code/[MyProject]/[Docs]/ProgramLearnNotes/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:18226:29) at addJsExtensionIfNecessary (file:///D:/Code/[MyProject]/[Docs]/ProgramLearnNotes/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:18220:20) at resolveId (file:///D:/Code/[MyProject]/[Docs]/ProgramLearnNotes/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:18217:12) at async ModuleLoader.resolveId (file:///D:/Code/[MyProject]/[Docs]/ProgramLearnNotes/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:18595:15) at async Object.resolveId (file:///D:/Code/[MyProject]/[Docs]/ProgramLearnNotes/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/chunks/dep-DkOS1hkm.js:8247:10) at async PluginDriver.hookFirstAndGetPlugin (file:///D:/Code/[MyProject]/[Docs]/ProgramLearnNotes/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:19511:28) at async resolveId (file:///D:/Code/[MyProject]/[Docs]/ProgramLearnNotes/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:18192:26) at async ModuleLoader.resolveId (file:///D:/Code/[MyProject]/[Docs]/ProgramLearnNotes/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:18595:15) at async file:///D:/Code/[MyProject]/[Docs]/ProgramLearnNotes/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:18899:50 { errno: -4058, code: 'ENOENT', syscall: 'lstat' }
Node.js v20.9.0 ELIFECYCLE Command failed with exit code 1.
Reproduction
打包错误的文档:https://github.com/muyaCode/ProgramLearnNotes
而我本地同级目录下另一个文档,能成功打包:https://github.com/muyaCode/FrontEndLearnNotes
Expected behavior
能成功打包
System Info
系统:Windows 11 家庭中文版
Additional context
Validations
- [X] Check if you're on the latest VitePress version.
- [X] Follow our Code of Conduct
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
找到问题了:图片目录带有🦀️,读取不到,但是为什么报错不显示详细错误?
This is fixed in Node 22, which now shows path argument when any fs call fails. Also, the newer versions of vitepress show the file where the bundling failed: