Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug report] Uncaught (in promise) Error: usePageHead() is called without provider. #885

Closed
persiliao opened this issue May 12, 2022 · 3 comments

Comments

@persiliao
Copy link

Description

I am developing a theme, when I call usePageFrontmatter, usePageHead and other methods in the theme, it will report Uncaught (in promise) Error: useXX() is called without provider. After debugging, I found that if I modify something like this, it will be normal

// src/composables/pageFrontmatter.ts
- var pageFrontmatterSymbol = Symbol(__VUEPRESS_DEV__ ? "pageFrontmatter" : "");
++ var pageFrontmatterSymbol = __VUEPRESS_DEV__ ? "pageFrontmatter" : "";

Everything works fine

Reproduction

Development...

Used Package Manager

pnpm

System Info

System:
    OS: macOS 11.6.5
    CPU: (12) x64 Genuine Intel(R) CPU 0000 @ 2.90GHz
    Memory: 322.52 MB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
    Yarn: 1.22.18 - /usr/local/bin/yarn
    npm: 8.5.2 - ~/.nvm/versions/node/v16.13.0/bin/npm
  Utilities:
    Git: 2.36.0 - /usr/local/bin/git
  Browsers:
    Chrome: 101.0.4951.64
    Edge: Not Found
    Firefox: 99.0.1
    Safari: 15.4
  npmPackages:
    @vuepress/bundler-vite: Not Found
    @vuepress/bundler-webpack: Not Found
    @vuepress/cli: Not Found
    @vuepress/client: ^2.0.0-beta.43 => 2.0.0-beta.43 
    @vuepress/core: Not Found
    @vuepress/markdown: Not Found
    @vuepress/plugin-active-header-links: Not Found
    @vuepress/plugin-back-to-top: Not Found
    @vuepress/plugin-container: Not Found
    @vuepress/plugin-docsearch: Not Found
    @vuepress/plugin-external-link-icon: Not Found
    @vuepress/plugin-git: Not Found
    @vuepress/plugin-google-analytics: Not Found
    @vuepress/plugin-medium-zoom: Not Found
    @vuepress/plugin-nprogress: Not Found
    @vuepress/plugin-palette: Not Found
    @vuepress/plugin-prismjs: Not Found
    @vuepress/plugin-pwa: Not Found
    @vuepress/plugin-pwa-popup: Not Found
    @vuepress/plugin-register-components: Not Found
    @vuepress/plugin-search: Not Found
    @vuepress/plugin-shiki: Not Found
    @vuepress/plugin-theme-data: Not Found
    @vuepress/plugin-toc: Not Found
    @vuepress/shared: Not Found
    @vuepress/theme-default: Not Found
    @vuepress/utils: Not Found
    vue: ^3.2.33 => 3.2.33 
    vue-loader: Not Found
    vue-router: Not Found
    vuepress: ^2.0.0-beta.43 => 2.0.0-beta.43 
    vuepress-vite: Not Found
    vuepress-webpack: Not Found
@Mister-Hope
Copy link
Member

Make sure you only have 1 single version of @vuepress/client installed.

I am willing to reopen this issue if you convince that and provide a reproduction repo

@github-actions
Copy link

Hello @persiliao. Please provide a minimal reproduction using a GitHub repository or v2.vuepress.vuejs.org/new. Issues marked with need reproduction will be closed if they have no activity within 3 days.

@persiliao
Copy link
Author

Yes, the reason is that I divided the theme and the test into two different projects and found that they each had @vuepress/client installed, albeit the same version
I synthesized a project and now it's normal, it's great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants