账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    vuepress build项目时报错 Cannot read property 'match' of undefined
    • 见心书画许老师187533751612020-01-01 00:00
    • 11
    14
    0

    报错信息如下:

    wait Rendering static HTML...
    Rendering page: /[Vue warn]: Error in render: "TypeError: Cannot read property 'match' of undefined"
    
    found in
    
    ---> <NavLink>
           <NavLinks>
             <Navbar>
               <Anonymous>
                 <Anonymous>
                   <Root>
    error Error rendering /: false
    undefined
    TypeError: Cannot read property 'match' of undefined
        at ensureExt (node_modules/@vuepress/theme-default/util/index.js:35:0)
        at Proxy.link (node_modules/@vuepress/theme-default/components/NavLink.vue:32:23)
        at Proxy.computedGetter (C:\Users\chenzhanwei\Desktop\Blog\node_modules\vue\dist\vue.runtime.common.dev.js:4825:15)
        at Proxy.NavLinkvue_type_template_id_1366ae69_render (node_modules/@vuepress/theme-default/components/NavLink.vue?ee96:1:89)
        at VueComponent.Vue._render (C:\Users\chenzhanwei\Desktop\Blog\node_modules\vue\dist\vue.runtime.common.dev.js:3532:22)
        at resolve (C:\Users\chenzhanwei\Desktop\Blog\node_modules\vue-server-renderer\build.dev.js:8400:27)
    
        at waitForServerPrefetch (C:\Users\chenzhanwei\Desktop\Blog\node_modules\vue-server-renderer\build.dev.js:8272:3)
        at renderComponentInner (C:\Users\chenzhanwei\Desktop\Blog\node_modules\vue-server-renderer\build.dev.js:8411:3)
        at renderComponent (C:\Users\chenzhanwei\Desktop\Blog\node_modules\vue-server-renderer\build.dev.js:8368:5)    at RenderContext.renderNode (C:\Users\chenzhanwei\Desktop\Blog\node_modules\vue-server-renderer\build.dev.js:8279:5)
        at RenderContext.next (C:\Users\chenzhanwei\Desktop\Blog\node_modules\vue-server-renderer\build.dev.js:2598:23)
        at cachedWrite (C:\Users\chenzhanwei\Desktop\Blog\node_modules\vue-server-renderer\build.dev.js:2451:9)
        at renderStringNode$1 (C:\Users\chenzhanwei\Desktop\Blog\node_modules\vue-server-renderer\build.dev.js:8496:5)
        at RenderContext.renderNode (C:\Users\chenzhanwei\Desktop\Blog\node_modules\vue-server-renderer\build.dev.js:8277:5)
        at RenderContext.next (C:\Users\chenzhanwei\Desktop\Blog\node_modules\vue-server-renderer\build.dev.js:2598:23)
        at RenderContext.cachedWrite [as write] (C:\Users\chenzhanwei\Desktop\Blog\node_modules\vue-server-renderer\build.dev.js:2451:9)
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! Blog@1.0.0 docs:build: `vuepress build docs`
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the Blog@1.0.0 docs:build 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!     C:\Users\chenzhanwei\AppData\Roaming\npm-cache\_logs\2019-06-22T16_02_28_395Z-debug.log
    0
    打赏
    收藏
    点击回答
    您的回答被采纳后将获得:提问者悬赏的 11 元积分
        全部回答
    • 0
    • 乆違的感覺 普通会员 1楼

      This error typically occurs when trying to use VuePress, a popular open-source blog and documentation generator for Vue.js, with a Vue component that is not properly defined. The error message "Cannot read property 'match' of undefined" indicates that the component you're trying to use is trying to access the match property from the Vue instance's matchMedia event listener, but the matchMedia event listener is not defined in your component's HTML.

      Here are the steps to resolve this issue:

      1. Make sure your VuePress project has properly installed the vuepress and vuepress-material packages:

      bash npm install -g vuepress npm install -g vuepress-material

      1. Create a new Vuepress project or navigate to an existing one:

      bash vuepress new my-project

      Replace my-project with the desired name for your project.

      1. Create a new src/components directory and add a new Vue component that should define the matchMedia event listener. The component should contain the following:

      ```html

      ```

      Replace the content inside the <div v-match="match"></div> tag with your actual content that you want to display in the blog or documentation.

      1. In your pages/_app.vue file, import and register the MatchMediaComponent:

      ```html

      ```

      Make sure to replace my-match with the value you defined in the props prop of the MatchMediaComponent. The props prop is required for the component to be properly registered and used in the parent component.

      1. Run the build command to generate the public directory and build your VuePress project:

      bash vuepress build

      1. Visit your VuePress project's root directory in your web browser (http://localhost:3000 in development mode) to see the built project with the MatchMediaComponent component.

      If you encounter any other issues or errors related to the MatchMediaComponent, please provide more details, including the component's code, the src directory structure, and any additional error messages or logs. These insights can help narrow down the issue and provide a more specific solution.

    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部