vuejs / vitepress

Vite & Vue powered static site generator.
https://vitepress.dev
MIT License
13.2k stars 2.13k forks source link

Build error: ERR_MODULE_NOT_FOUND #874

Closed AGou-ops closed 2 years ago

AGou-ops commented 2 years ago

Describe the bug

Unable to build my docs. Full error log below:

❯ yarn build
yarn run v1.22.17
$ vitepress build docs
vitepress v1.0.0-alpha.4
⠋ building client + server bundles...(node:800) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
⠹ building client + server bundles...
(!) Some chunks are larger than 500 KiB after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/guide/en/#outputmanualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
✓ building client + server bundles...
⠹ rendering pages...Error: Cannot find module './CloudNative_ELFK_ELK+Redis缓存以及日志分流.md.js'
Require stack:
- /Users/agou-ops/tmp/vitepress_tmp/docs/.vitepress/.temp/app.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:939:15)
    at Module._load (node:internal/modules/cjs/loader:780:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at /Users/agou-ops/tmp/vitepress_tmp/docs/.vitepress/.temp/app.js:4877:50
    at async loadPage (/Users/agou-ops/tmp/vitepress_tmp/docs/.vitepress/.temp/app.js:1043:16) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/Users/agou-ops/tmp/vitepress_tmp/docs/.vitepress/.temp/app.js' ]
}
✖ rendering pages...
build error:
 Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/Users/agou-ops/tmp/vitepress_tmp/docs/.vitepress/.temp/CloudNative_ELFK_ELK+Redis缓存以及日志分流.md.js' imported from /Users/agou-ops/tmp/vitepress_tmp/node_modules/vitepress/dist/node/serve-05342c3d.js
    at new NodeError (node:internal/errors:372:5)
    at finalizeResolution (node:internal/modules/esm/resolve:405:11)
    at moduleResolve (node:internal/modules/esm/resolve:966:10)
    at defaultResolve (node:internal/modules/esm/resolve:1176:11)
    at ESMLoader.resolve (node:internal/modules/esm/loader:605:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:318:18)
    at ESMLoader.import (node:internal/modules/esm/loader:404:22)
    at importModuleDynamically (node:internal/modules/esm/translators:106:35)
    at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14)
    at renderPage (file:///Users/agou-ops/tmp/vitepress_tmp/node_modules/vitepress/dist/node/serve-05342c3d.js:39555:106) {
  code: 'ERR_MODULE_NOT_FOUND'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

How should I fix it?

Reproduction

just run build command.

Expected behavior

build success.

System Info

System:
    OS: macOS 12.4
    CPU: (10) arm64 Apple M1 Pro
    Memory: 69.44 MB / 16.00 GB
    Shell: 5.9 - /opt/homebrew/bin/zsh
  Binaries:
    Node: 18.0.0 - /opt/homebrew/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 8.9.0 - /opt/homebrew/bin/npm
  Browsers:
    Chrome: 103.0.5060.53
    Firefox: 100.0.2
    Safari: 15.5
  npmPackages:
    vitepress: ^1.0.0-alpha.4 => 1.0.0-alpha.4

Additional context

No response

Validations

AGou-ops commented 2 years ago

It seems to be a problem with the file name. Cannot contain some characters.

brc-dd commented 2 years ago

Can you provide a minimal, reproducible example for this? I am guessing this is because you have a + in your file name? IIRC + is a reserved character on certain filesystems (and urls). Don't think we should support adding it.

AGou-ops commented 2 years ago

Can you provide a minimal, reproducible example for this? I am guessing this is because you have a + in your file name? IIRC + is a reserved character on certain filesystems (and urls). Don't think we should support adding it.

Tank you for your reply. Yes, I use + in my file name. And I remove +, it can build normally. I've been using VuePress, it works fine with these filename.😂