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

执行hexo g命令时,出现找不到markdown-it下token模块的问题 #14

Open
UniStart2 opened this issue May 16, 2024 · 0 comments

Comments

@UniStart2
Copy link

本机环境

  • OS:Windows 11 23H2
  • Node.js:v18.18.1
  • hexo: 6.2.0

package.json

{
  "name": "hexo-site",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "build": "hexo generate",
    "clean": "hexo clean",
    "deploy": "hexo deploy",
    "server": "hexo server"
  },
  "hexo": {
    "version": "6.2.0"
  },
  "dependencies": {
    "hexo": "^6.2.0",
    "hexo-abbrlink": "^2.2.1",
    "hexo-algoliasearch": "^1.0.0",
    "hexo-autoprefixer": "^2.0.0",
    "hexo-blog-encrypt": "^3.1.6",
    "hexo-deployer-git": "^3.0.0",
    "hexo-generator-archive": "^1.0.0",
    "hexo-generator-category": "^1.0.0",
    "hexo-generator-index": "^2.0.0",
    "hexo-generator-tag": "^1.0.0",
    "hexo-renderer-ejs": "^2.0.0",
    "hexo-renderer-multi-next-markdown-it": "^0.2.1",
    "hexo-renderer-stylus": "^2.1.0",
    "hexo-server": "^3.0.0",
    "hexo-symbols-count-time": "^0.7.1",
    "hexo-tag-hint": "^0.3.1",
    "hexo-theme-landscape": "^0.0.3",
    "markdown-it-attrs": "^4.1.6",
    "markdown-it-spoiler": "^1.1.1",
    "pangu": "^4.0.7"
  },
  "devDependencies": {
    "hexo-feed": "^1.1.1",
    "markdown-it-container": "^3.0.0"
  }
}

_config.yaml 配置

这里的markdown渲染器配置,还是使用的之前的hexo-renderer-multi-markdown-it的配置

# hexo-renderer-multi-markdown-it 配置
markdown:
  render: # 渲染器设置
    html: false # 过滤 HTML 标签
    xhtmlOut: true # 使用 '/' 来闭合单标签 (比如 <br />)。
    breaks: true # 转换段落里的 '\n' 到 <br>。
    linkify: true # 将类似 URL 的文本自动转换为链接。
    typographer: 
    quotes: '“”‘’'
  plugins: # markdown-it 插件设置
    - plugin:
        name: markdown-it-toc-and-anchor
        enable: true
        options: # 文章目录以及锚点应用的 class 名称,shoka 主题必须设置成这样
          tocClassName: 'toc'
          anchorClassName: 'anchor'
    - plugin:
        name: markdown-it-multimd-table
        enable: true
        options:
          multiline: true
          rowspan: true
          headerless: true
    - plugin:
        name: ./markdown-it-furigana
        enable: true
        options:
          fallbackParens: "()"
    - plugin:
        name: ./markdown-it-spoiler
        enable: true
        options:
          title: "你知道得太多了"

执行 hexo g 命令时出现问题

老是说markdown-it下的token模块找不到,也不知道是什么问题引起的。我之前用的hexo-renderer-multi-markdown-it渲染器,在Windows上也是同样的问题,后来换成了本项目hexo-renderer-multi-next-markdown-it好像还是一样的问题。

hexo g

INFO  Validating config
INFO  Start processing
ERROR Process failed: languages/README.md
Error: Cannot find module 'E:\Project\hexo-shoka\node_modules\markdown-it\lib\token'
    at createEsmNotFoundErr (node:internal/modules/cjs/loader:1098:15)
    at finalizeEsmResolution (node:internal/modules/cjs/loader:1091:15)
    at resolveExports (node:internal/modules/cjs/loader:567:14)
    at Module._findPath (node:internal/modules/cjs/loader:636:31)
    at Module._resolveFilename (node:internal/modules/cjs/loader:1063:27)
    at Module._load (node:internal/modules/cjs/loader:922:27)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at Object.<anonymous> (E:\Project\hexo-shoka\node_modules\markdown-it-toc-and-anchor\dist\index.js:12:37)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at E:\Project\hexo-shoka\node_modules\hexo-renderer-multi-next-markdown-it\lib\renderer\index.js:79:20
    at Array.reduce (<anonymous>)
    at module.exports (E:\Project\hexo-shoka\node_modules\hexo-renderer-multi-next-markdown-it\lib\renderer\index.js:77:20)
    at Hexo.tryCatcher (E:\Project\hexo-shoka\node_modules\bluebird\js\release\util.js:16:23)
    at Hexo.<anonymous> (E:\Project\hexo-shoka\node_modules\bluebird\js\release\method.js:15:34)
    at E:\Project\hexo-shoka\node_modules\hexo\lib\hexo\render.js:81:22
    at tryCatcher (E:\Project\hexo-shoka\node_modules\bluebird\js\release\util.js:16:23)
FATAL Something's wrong. Maybe you can find the solution here: https://hexo.io/docs/troubleshooting.html
Error: Cannot find module 'E:\Project\hexo-shoka\node_modules\markdown-it\lib\token'
    at createEsmNotFoundErr (node:internal/modules/cjs/loader:1098:15)
    at finalizeEsmResolution (node:internal/modules/cjs/loader:1091:15)
    at resolveExports (node:internal/modules/cjs/loader:567:14)
    at Module._findPath (node:internal/modules/cjs/loader:636:31)
    at Module._resolveFilename (node:internal/modules/cjs/loader:1063:27)
    at Module._load (node:internal/modules/cjs/loader:922:27)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at Object.<anonymous> (E:\Project\hexo-shoka\node_modules\markdown-it-toc-and-anchor\dist\index.js:12:37)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at E:\Project\hexo-shoka\node_modules\hexo-renderer-multi-next-markdown-it\lib\renderer\index.js:79:20
    at Array.reduce (<anonymous>)
    at module.exports (E:\Project\hexo-shoka\node_modules\hexo-renderer-multi-next-markdown-it\lib\renderer\index.js:77:20)
    at Hexo.tryCatcher (E:\Project\hexo-shoka\node_modules\bluebird\js\release\util.js:16:23)
    at Hexo.<anonymous> (E:\Project\hexo-shoka\node_modules\bluebird\js\release\method.js:15:34)
    at E:\Project\hexo-shoka\node_modules\hexo\lib\hexo\render.js:81:22
    at tryCatcher (E:\Project\hexo-shoka\node_modules\bluebird\js\release\util.js:16:23)

我看了一下node_modules下面的依赖包代码,没看出来什么问题

image

image

有大佬知道如何解决这个markdown渲染器的问题么

@UniStart2 UniStart2 changed the title 执行hexo g命令时,出现找不到markdown-it模块的问题 执行hexo g命令时,出现找不到markdown-it下token模块的问题 May 16, 2024
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

1 participant