Heim > Fragen und Antworten > Hauptteil
Ich habe beim Versuch, mein Vuepress-Projekt mithilfe der npm-Schnellstartanleitung zu erstellen, eine Fehlermeldung erhalten: https://vuepress.vuejs.org/guide/getting-started.html#manual-installation
Ich habe einige Seiten hinzugefügt und alles funktioniert gut:
npm run:dev
Aber wenn ich HTML in docs/src/.vuepress generieren möchte:
npm run:build dibTest@0.0.1 build vuepress build src wait Extracting site metadata... tip Apply theme @vuepress/theme-default ... tip Apply plugin container (i.e. "vuepress-plugin-container") ... tip Apply plugin @vuepress/register-components (i.e. "@vuepress/plugin-register-components") ... tip Apply plugin @vuepress/active-header-links (i.e. "@vuepress/plugin-active-header-links") ... tip Apply plugin @vuepress/search (i.e. "@vuepress/plugin-search") ... tip Apply plugin @vuepress/nprogress (i.e. "@vuepress/plugin-nprogress") ... tip Apply plugin @vuepress/back-to-top (i.e. "@vuepress/plugin-back-to-top") ... tip Apply plugin @vuepress/medium-zoom (i.e. "@vuepress/plugin-medium-zoom") ... i Compiling Client i Compiling Server √ Server: Compiled successfully in 21.54s √ Client: Compiled successfully in 33.41s wait Rendering static HTML... [vuepress] No matching page found for sidebar item "/index" [Vue warn]: Error in render: "TypeError: Cannot read properties of undefined (reading 'match')" found in ---> <SidebarLinks> <DropdownTransition> [vuepress] No matching page found for sidebar item "/elements/attribute" error Error rendering /: false undefined TypeError: Cannot read properties of undefined (reading 'match') at getHash (node_modules/@vuepress/theme-default/util/index.js:13:21) at isActive (node_modules/@vuepress/theme-default/util/index.js:47:19) at render (node_modules/@vuepress/theme-default/components/SidebarLink.vue:25:0) at renderWithStyleInjection (node_modules/vue-loader/lib/runtime/componentNormalizer.js:83:0) at createFunctionalComponent (docsnode_modulesvuedistvue.runtime.common.dev.js:3071:30) at createComponent (docsnode_modulesvuedistvue.runtime.common.dev.js:3244:12) at _createElement (docsnode_modulesvuedistvue.runtime.common.dev.js:3436:15) at createElement (docsnode_modulesvuedistvue.runtime.common.dev.js:3368:10) at vm._c (docsnode_modulesvuedistvue.runtime.common.dev.js:3505:42) at 1.server-bundle.js:1006:492 at Proxy.renderList (docsnode_modulesvuedistvue.runtime.common.dev.js:2640:16) at Proxy.SidebarLinksvue_type_template_id_1da4684a_render (node_modules/@vuepress/theme-default/components/SidebarLinks.vue?5fd7:1:152) at VueComponent.Vue._render (docsnode_modulesvuedistvue.runtime.common.dev.js:3559:22) at resolve (docsnode_modulesvue-server-rendererbuild.dev.js:8444:27) at waitForServerPrefetch (docsnode_modulesvue-server-rendererbuild.dev.js:8316:3) at renderComponentInner (docsnode_modulesvue-server-rendererbuild.dev.js:8455:3)
P粉5205457532023-12-31 12:03:52
这个错误是由我的 config.js 中的以下问题引发的
module.exports = { ... sidebar: [ '/', { title: 'Quick Start Guide', children: [ '/overview/login.md', '/overview/model-list.md', '/overview/navigation.md,' ] } ] } }
注意“navigation.md”后面的“,”。无论出于何种原因,这都会导致上述完全无用的消息。一定是因为它找不到该 md 文件,然后它在某处获取未定义并尝试访问它,而不是检测到它并给您提供有用的消息