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

升级主题后,无法运行 #145

Closed
Deer404 opened this issue Oct 28, 2023 · 4 comments
Closed

升级主题后,无法运行 #145

Deer404 opened this issue Oct 28, 2023 · 4 comments

Comments

@Deer404
Copy link
Contributor

Deer404 commented Oct 28, 2023

复现步骤:

pnpm up @sugarat/theme
pnpm add vitepress@latest

package.json

{
  "name": "vitepress-blog",
  "version": "1.0.0",
  "private": true,
  "scripts": {
    "dev": "vitepress dev docs",
    "build": "vitepress build docs",
    "serve": "vitepress serve docs"
  },
  "dependencies": {
    "@element-plus/icons-vue": "^2.1.0",
    "@sugarat/theme": "^0.1.50",
    "element-plus": "^2.4.1",
    "vue": "^3.3.7"
  },
  "devDependencies": {
    "sass": "^1.69.5",
    "typescript": "^4.9.5",
    "vitepress": "1.0.0-rc.24"
  },
  "author": "Deer404",
  "license": "MIT"
}

报错信息

failed to load config from /Volumes/DataDocument/CodeSpace/Deer404/blog_vitepress/docs/.vitepress/config.ts
failed to start server. error:
Error [ERR_REQUIRE_ESM]: require() of ES Module /Volumes/DataDocument/CodeSpace/Deer404/blog_vitepress/node_modules/.pnpm/vitepress-plugin-mermaid@2.0.15_mermaid@10.6.0_vitepress@1.0.0-rc.24/node_modules/vitepress-plugin-mermaid/dist/vitepress-plugin-mermaid.umd.js from /Volumes/DataDocument/CodeSpace/Deer404/blog_vitepress/node_modules/.pnpm/@sugarat+theme@0.1.50_typescript@4.9.5_vitepress@1.0.0-rc.24_vue@3.3.7/node_modules/@sugarat/theme/node.js not supported.
vitepress-plugin-mermaid.umd.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules.
Instead rename vitepress-plugin-mermaid.umd.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in /Volumes/DataDocument/CodeSpace/Deer404/blog_vitepress/node_modules/.pnpm/vitepress-plugin-mermaid@2.0.15_mermaid@10.6.0_vitepress@1.0.0-rc.24/node_modules/vitepress-plugin-mermaid/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).

    at _require.extensions.<computed> [as .js] (file:///Volumes/DataDocument/CodeSpace/Deer404/blog_vitepress/node_modules/.pnpm/vite@4.5.0_sass@1.69.5/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:66343:17)
    at getMarkdownPlugins (/Volumes/DataDocument/CodeSpace/Deer404/blog_vitepress/node_modules/.pnpm/@sugarat+theme@0.1.50_typescript@4.9.5_vitepress@1.0.0-rc.24_vue@3.3.7/node_modules/@sugarat/theme/node.js:296:35)
    at getThemeConfig (/Volumes/DataDocument/CodeSpace/Deer404/blog_vitepress/node_modules/.pnpm/@sugarat+theme@0.1.50_typescript@4.9.5_vitepress@1.0.0-rc.24_vue@3.3.7/node_modules/@sugarat/theme/node.js:583:26)
    at Object.<anonymous> (/Volumes/DataDocument/CodeSpace/Deer404/blog_vitepress/docs/.vitepress/config.ts:26:48)
    at _require.extensions.<computed> [as .js] (file:///Volumes/DataDocument/CodeSpace/Deer404/blog_vitepress/node_modules/.pnpm/vite@4.5.0_sass@1.69.5/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:66340:24)
    at loadConfigFromBundledFile (file:///Volumes/DataDocument/CodeSpace/Deer404/blog_vitepress/node_modules/.pnpm/vite@4.5.0_sass@1.69.5/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:66348:21)
    at async loadConfigFromFile (file:///Volumes/DataDocument/CodeSpace/Deer404/blog_vitepress/node_modules/.pnpm/vite@4.5.0_sass@1.69.5/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:66171:28)
    at async resolveUserConfig (file:///Volumes/DataDocument/CodeSpace/Deer404/blog_vitepress/node_modules/.pnpm/vitepress@1.0.0-rc.24_@algolia+client-search@4.20.0_sass@1.69.5_search-insights@2.9.0_typescript@4.9.5/node_modules/vitepress/dist/node/serve-FiwKdDMo.js:19878:27)
    at async resolveConfig (file:///Volumes/DataDocument/CodeSpace/Deer404/blog_vitepress/node_modules/.pnpm/vitepress@1.0.0-rc.24_@algolia+client-search@4.20.0_sass@1.69.5_search-insights@2.9.0_typescript@4.9.5/node_modules/vitepress/dist/node/serve-FiwKdDMo.js:19811:48)
    at async createServer (file:///Volumes/DataDocument/CodeSpace/Deer404/blog_vitepress/node_modules/.pnpm/vitepress@1.0.0-rc.24_@algolia+client-search@4.20.0_sass@1.69.5_search-insights@2.9.0_typescript@4.9.5/node_modules/vitepress/dist/node/serve-FiwKdDMo.js:70084:18)
    at async createDevServer (file:///Volumes/DataDocument/CodeSpace/Deer404/blog_vitepress/node_modules/.pnpm/vitepress@1.0.0-rc.24_@algolia+client-search@4.20.0_sass@1.69.5_search-insights@2.9.0_typescript@4.9.5/node_modules/vitepress/dist/node/cli.js:405:20)
@ATQQ
Copy link
Owner

ATQQ commented Oct 28, 2023

好滴 我今天找个时间看一下 你看回退一下vitepress版本到rc21可以吗

看看是哪个引出来的问题

@ATQQ
Copy link
Owner

ATQQ commented Oct 28, 2023

"@sugarat/theme": "^0.2.5",

你装latest包的主题

@ATQQ
Copy link
Owner

ATQQ commented Oct 28, 2023

我这边测试OK的 你升级到最新的 26 应该就是ok的

pnpm add @sugarat/theme@latest

@ATQQ ATQQ closed this as completed Oct 28, 2023
@Deer404
Copy link
Contributor Author

Deer404 commented Oct 28, 2023

我这边测试OK的 你升级到最新的 26 应该就是ok的

pnpm add @sugarat/theme@latest

谢谢你 修复成功

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

No branches or pull requests

2 participants