常见注意事项和常见错误
2024年2月2日大约 3 分钟约 886 字
1.文件名字中尽量不要用空格
2.升级vuerouter的版本到3.5.4以上。
但是我自己的版本升级到最新和升级到3.5.7都会出问题3.中一个没有过多自己文件的空项目尝试run build之后再进行个人文件添加
错误一:No matching page found for sidebar item
[vuepress] No matching page found for sidebar item "/前端工程化/18.错误处理/2.error500.md"
[vuepress] No matching page found for sidebar item "/前端工程化/18.错误处理/2.error500.md"
<--- Last few GCs --->
[24932:000002A261917140] 399956 ms: Mark-sweep (reduce) 2039.6 (2052.2) -> 2039.0 (2054.0) MB, 1288.9 / 0.1 ms (average mu = 0.211, current mu = 0.015) allocation failure scavenge might not succeed
[24932:000002A261917140] 401318 ms: Mark-sweep (reduce) 2040.1 (2056.0) -> 2039.5 (2056.2) MB, 1296.8 / 0.1 ms (average mu = 0.131, current mu = 0.047) allocation failure scavenge might not succeed
<--- JS stacktrace --->
FATAL ERROR: MarkCompactCollector: young object promotion failed Allocation failed - JavaScript heap out of memory
1: 00007FF74464058F napi_wrap+109311
2: 00007FF7445E52B6 v8::internal::OrderedHashTable<v8::internal::OrderedHashSet,1>::NumberOfElementsOffset+33302
3: 00007FF7445E6086 node::OnFatalError+294
4: 00007FF744EB150E v8::Isolate::ReportExternalAllocationLimitReached+94
5: 00007FF744E9638D v8::SharedArrayBuffer::Externalize+781
6: 00007FF744D4081C v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1516
7: 00007FF744D2B45B v8::internal::NativeContextInferrer::Infer+59243
8: 00007FF744D1098F v8::internal::MarkingWorklists::SwitchToContextSlow+57327
9: 00007FF744D245DB v8::internal::NativeContextInferrer::Infer+30955
10: 00007FF744D1B6FD v8::internal::MarkCompactCollector::EnsureSweepingCompleted+6269
11: 00007FF744D2382E v8::internal::NativeContextInferrer::Infer+27454
12: 00007FF744D277BB v8::internal::NativeContextInferrer::Infer+43723
13: 00007FF744D31012 v8::internal::ItemParallelJob::Task::RunInternal+18
14: 00007FF744D30FA1 v8::internal::ItemParallelJob::Run+641
15: 00007FF744D048A3 v8::internal::MarkingWorklists::SwitchToContextSlow+7939
16: 00007FF744D1BBAC v8::internal::MarkCompactCollector::EnsureSweepingCompleted+7468
17: 00007FF744D1A3F4 v8::internal::MarkCompactCollector::EnsureSweepingCompleted+1396
18: 00007FF744D17F58 v8::internal::MarkingWorklists::SwitchToContextSlow+87480
19: 00007FF744D465A1 v8::internal::Heap::LeftTrimFixedArray+929
20: 00007FF744D48685 v8::internal::Heap::PageFlagsAreConsistent+789
21: 00007FF744D3D931 v8::internal::Heap::CollectGarbage+2033
22: 00007FF744D3BB35 v8::internal::Heap::AllocateExternalBackingStore+1317
23: 00007FF744D5BF27 v8::internal::Factory::NewFillerObject+183
24: 00007FF744A8BFB1 v8::internal::interpreter::JumpTableTargetOffsets::iterator::operator=+1409
25: 00007FF744F39EBD v8::internal::SetupIsolateDelegate::SetupHeap+463949
26: 00007FF744FA93ED v8::internal::SetupIsolateDelegate::SetupHeap+919933
27: 00000136DF7245C6
npm ERR! code ELIFECYCLE
npm ERR! errno 134
npm ERR! theme-vdoing-blog@1.0.0 build:test: `vuepress build docs`
npm ERR! Exit status 134
npm ERR!
npm ERR! Failed at the theme-vdoing-blog@1.0.0 build:test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! D:\nodejs_package\npm_modules\_logs\2024-01-24T22_10_40_264Z-debug.log指定vue-router版本为3.4.5后就可以了,能解决同样的问题还有url无法直达https://github.com/vuejs/vue-router/issues/3337
错误2:[BABEL] Note: The code generator has deoptimised the styling of F:\aXingknowledgeRepo_3080\docs\前端三件套\6.【他山之石】《JavaScript教程》笔记\07.浏览器模型.md as it exceeds the max of 500KB.
错误三:[Vue warn]: Error in render: "RangeError: Maximum call stack size exceeded"
答案:
Try it with node --max_old_space_size=8192 ./node_modules/vuepress/cli.js build src or node --max_old_space_size=4096 ./node_modules/vuepress/cli.js build src. Node.js default old space size is 2GB, and your site needs more while vuepress building. @isaacrlevin There may be possible memory leak in build process cased by the other isssue you trigged,
My blog has nealy 700 pages, and it will take 6GB spare space to build.
Vuepress is bad with build process. From the source code, it will generate a lot of shallow copy with frontmatter, page object(including slug, frontmatter, headings and some other info) and even siteData copy. The build process is using a newer copy of these objects while referencing some parts of the old ones, so the old ones will move to "old space" instead of being gc off.
I had opened issues about this problem, but now none of the core team is active contribuiting on V1. Hope @meteorlxy 's V2 can improve this problem.也就是:
"dev:win": "node -max_old_space_size=8192 ./node_modules/vuepress/cli.js dev docs","build:win": "node --max_old_space_size=8192 ./node_modules/vuepress/cli.js build docs",错误四:node: --openssl-legacy-provider is not allowed in NODE_OPTIONS
错误五:变异速度过慢(未解决)
错误六:URIError: URI malformed
代码:
export function normalize(path) {
return decodeURI(path)
.replace(hashRE, '')
.replace(extRE, '')
}解决:
url加密传参有时候会出现Uncaught URIError: URI malformed的错误,这是因为你的url中包含了“%”字符,浏览器在对“%”执行decodeURIComponent时报错,正确的解决是将%全部替换为%25再进行传输:
urlStr.replace(/%/g, '%25');