nextjs15 turbopack下semi MarkdownRender报错
本文最后更新于91 天前,其中的信息可能已经过时,如有错误请发送邮件到3088506834@qq.com

报错信息

"C:\Program Files\nodejs\npm.cmd" run dev

> frontend-yudream-website@0.1.0 dev
> next dev --turbopack

    Next.js 15.4.7 (Turbopack)
   - Local:        http://localhost:3000
   - Network:      http://192.168.92.1:3000

  Starting...
  Ready in 2.9s
  Compiling / ...
  Compiled / in 6.2s
  ./node_modules/.pnpm/@douyinfe+semi-foundation@2_1e37579b6e1be775dae9481d6cf4e6ce/node_modules/@douyinfe/semi-foundation/lib/es/codeHighlight/codeHighlight.css:31:57
Parsing css source code failed
  29 | .semi-codeHighlight-defaultTheme pre[class*=language-]::selection,
  30 | .semi-codeHighlight-defaultTheme code[class*=language-]::selection,
> 31 | .semi-codeHighlight-defaultTheme pre[class*=language-]::mozselection,
     |                                                         ^
  32 | .semi-codeHighlight-defaultTheme code[class*=language-]::mozselection {
  33 |   text-shadow: none;
  34 |   background: #b3d4fc;

'mozselection' is not recognized as a valid pseudo-element. Did you mean ':mozselection' (pseudo-class) or is this a typo? at [project]/node_modules/.pnpm/@douyinfe+semi-foundation@2_1e37579b6e1be775dae9481d6cf4e6ce/node_modules/@douyinfe/semi-foundation/lib/es/codeHighlight/codeHighlight.css:30:56

Import trace:
  ./node_modules/.pnpm/@douyinfe+semi-foundation@2_1e37579b6e1be775dae9481d6cf4e6ce/node_modules/@douyinfe/semi-foundation/lib/es/codeHighlight/codeHighlight.css [Client Component Browser]
  ./node_modules/.pnpm/@douyinfe+semi-ui@2.85.0_ac_a4d0756e0017d49abc11942b48f5e4c2/node_modules/@douyinfe/semi-ui/lib/es/codeHighlight/index.js [Server Component]
  ./node_modules/.pnpm/@douyinfe+semi-ui@2.85.0_ac_a4d0756e0017d49abc11942b48f5e4c2/node_modules/@douyinfe/semi-ui/lib/es/markdownRender/components/code.js [Server Component]
  ./node_modules/.pnpm/@douyinfe+semi-ui@2.85.0_ac_a4d0756e0017d49abc11942b48f5e4c2/node_modules/@douyinfe/semi-ui/lib/es/markdownRender/components/index.js [Server Component]
  ./node_modules/.pnpm/@douyinfe+semi-ui@2.85.0_ac_a4d0756e0017d49abc11942b48f5e4c2/node_modules/@douyinfe/semi-ui/lib/es/markdownRender/index.js [Server Component]
  ./src/app/components/home-about/HomeAbout.tsx [Server Component]
  ./src/app/page.tsx [Server Component]


  Compiling /_error ...
  Compiled /_error in 1411ms
 GET / 500 in 8151ms
  Compiled /favicon.ico in 236ms
Bash

解决方案

使用pnpm的patch补丁对@douyinfe+semi-foundation包进行修改

pnpm patch官方

解决步骤

生成patch目录

pnpm patch @douyinfe/semi-foundation@2.85.0 
Bash

返回

Patch: You can now edit the package at:

  C:\Users\mcexq\IdeaProjects\YuDream Website\frontend-yudream-website\node_modules\.pnpm_patches\@douyinfe\semi-foundation@2.85.0

To commit your changes, run:

  pnpm patch-commit "C:\Users\mcexq\IdeaProjects\YuDream Website\frontend-yudream-website\node_modules\.pnpm_patches\@douyinfe\semi-foundation@2.85.0"
Bash

在C:\Users\mcexq\IdeaProjects\YuDream Website\frontend-yudream-website\node_modules.pnpm_patches\@douyinfe\semi-foundation@2.85.0中将如下几个文件修改

  • lib\es\codeHighlight\codeHighlight.css
  • lib/es/codeHighlight/codeHighlight.scss
  • codeHighlight/codeHighlight.scss

将上述几个文件的mozselection修改为-moz-selection

使用上提示的pnpm patch-commit进行提交

pnpm patch-commit "C:\Users\mcexq\IdeaProjects\YuDream Website\frontend-yudream-website\node_modules\.pnpm_patches\@douyinfe\semi-foundation@2.85.0"
Bash

patch会自动在pnpm-workspace.yaml记录

其他人使用pnpm install时会自动根据pnpm-workspace.yaml安装补丁

暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇