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] Error: usePageFrontmatter () is called without provider. #1432

Closed
recoluan opened this issue Nov 18, 2023 · 5 comments
Closed
Labels
question Asking question stale

Comments

@recoluan
Copy link

Description

When I bump the vuepress dependencies of the custom theme to 2.0.0-rc.0 from 2.0.0-beta.67 , I reported the error "chunk-DHNSDB55.js?v=dbacff81:43 Uncaught (in promise) Error: usePageFrontmatter () is called without provider."

image

Reproduction

https://github.com/vuepress-reco/vuepress-theme-reco/tree/feature/bump-dependencies-to-2.0.0-rc.0

Used Package Manager

pnpm

System Info

System:
    OS: macOS 14.1.1
    CPU: (8) arm64 Apple M1 Pro
    Memory: 468.98 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.9.0 - ~/.nvm/versions/node/v18.9.0/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.7.1 - ~/.nvm/versions/node/v18.9.0/bin/npm
  Utilities:
    Git: 2.36.1 - /opt/homebrew/bin/git
  Browsers:
    Chrome: Not Found
    Edge: Not Found
    Safari: 17.1
  npmPackages:
    @vuepress/bundler-vite: 2.0.0-rc.0 => 2.0.0-rc.0 
    @vuepress/bundler-webpack: 2.0.0-rc.0 => 2.0.0-rc.0 
    @vuepress/cli: Not Found
    @vuepress/client: 2.0.0-rc.0 => 2.0.0-rc.0 
    @vuepress/core: 2.0.0-rc.0 => 2.0.0-rc.0 
    @vuepress/markdown: Not Found
    @vuepress/plugin-active-header-links: 2.0.0-rc.0 => 2.0.0-rc.0 
    @vuepress/plugin-back-to-top: 2.0.0-rc.0 => 2.0.0-rc.0 
    @vuepress/plugin-container: 2.0.0-rc.0 => 2.0.0-rc.0 
    @vuepress/plugin-docsearch: 2.0.0-rc.0 => 2.0.0-rc.0 
    @vuepress/plugin-external-link-icon: 2.0.0-rc.0 => 2.0.0-rc.0 
    @vuepress/plugin-git: 2.0.0-rc.0 => 2.0.0-rc.0 
    @vuepress/plugin-google-analytics: Not Found
    @vuepress/plugin-medium-zoom: 2.0.0-rc.0 => 2.0.0-rc.0 
    @vuepress/plugin-nprogress: 2.0.0-rc.0 => 2.0.0-rc.0 
    @vuepress/plugin-palette: 2.0.0-rc.0 => 2.0.0-rc.0 
    @vuepress/plugin-prismjs: 2.0.0-rc.0 => 2.0.0-rc.0 
    @vuepress/plugin-pwa: Not Found
    @vuepress/plugin-pwa-popup: Not Found
    @vuepress/plugin-register-components: 2.0.0-rc.0 => 2.0.0-rc.0 
    @vuepress/plugin-search: 2.0.0-rc.0 => 2.0.0-rc.0 
    @vuepress/plugin-shiki: Not Found
    @vuepress/plugin-theme-data: 2.0.0-rc.0 => 2.0.0-rc.0 
    @vuepress/plugin-toc: Not Found
    @vuepress/shared: 2.0.0-rc.0 => 2.0.0-rc.0 
    @vuepress/theme-default: Not Found
    @vuepress/utils: 2.0.0-rc.0 => 2.0.0-rc.0 
    vue: ^3.3.4 => 3.3.8 
    vue-loader: Not Found
    vue-router: ^4.2.5 => 4.2.5 
    vuepress: Not Found
    vuepress-vite: Not Found
    vuepress-webpack: Not Found
@ntnyq
Copy link
Contributor

ntnyq commented Nov 18, 2023

#885

@meteorlxy
Copy link
Member

image

It seems that you have two different copies in your node_modules with different typescript version. Please consider:

  • Check your tyescript version and make them consistent.
  • Run pnpm dedupe

@meteorlxy meteorlxy added the question Asking question label Nov 19, 2023
@recoluan
Copy link
Author

After I upgraded the version of 'typescript', I reported the following exception:

image

@recoluan
Copy link
Author

After I upgraded the version of 'typescript', I reported the following exception:

image

I found that this error occurs in plugin only, so I implemented useThemeLocaleData in plugin to solve this problem, but I don't know if there is any other good way. Similar issue in the past have been for a long time and have no reference value.

image

@Mister-Hope
Copy link
Member

Mister-Hope commented Nov 23, 2023

I believed this is also because of multiple package instances in your repo. Double check that. At least we have no issues in vuepress-theme-hope repo, which probably has 3x lines comparing to your repo and also with a lot of plugins.

It also use plugin-theme-data and calls useThemeLocaleData, but works well.

@Mister-Hope Mister-Hope closed this as not planned Won't fix, can't repro, duplicate, stale Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Asking question stale
Projects
None yet
Development

No branches or pull requests

4 participants