嘗試建立我的 vuepress 專案時出錯,使用 npm 快速入門指南: https://vuepress.vuejs.org/guide/getting-started.html#manual-installation
我新增了一些頁面,一切正常:
npm run:dev
但是當我想要產生 html 到 docs/src/.vuepress 時:
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)
這個錯誤是由我的 config.js 中的以下問題引發的
注意「navigation.md」後面的「,」。無論出於何種原因,這都會導致上述完全無用的消息。一定是因為它找不到該 md 文件,然後它在某處獲取未定義並嘗試訪問它,而不是檢測到它並給您有用的消息