pengzhanbo / vuepress-theme-plume

Vuepress Theme. A simple, feature-rich, document & blog
https://theme-plume.vuejs.press
MIT License
48 stars 11 forks source link

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@internal/routes' #81

Closed Taebers closed 1 month ago

Taebers commented 1 month ago

在进行 npm run docs:build 的时候,构建的最后阶段会提示这个错误,我前端能力有限,不知道问题出在哪里,大佬能不能帮忙看一下? 目前的情况是,我进行 npm run docs:dev 时,本地测试一切正常了,就是构建时候出现这个问题。 详细的报错如下: ✔ Compiling with vite - done in 18.15s ✖ Rendering 44 pages - failed in 33ms Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@internal/routes' imported from /....../my_blog/node_modules/@vuepress/client/dist/chunk-FJNK2BS7.js at packageResolve (node:internal/modules/esm/resolve:853:9) at moduleResolve (node:internal/modules/esm/resolve:910:20) at defaultResolve (node:internal/modules/esm/resolve:1130:11) at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:396:12) at ModuleLoader.resolve (node:internal/modules/esm/loader:365:25) at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:240:38) at ModuleWrap. (node:internal/modules/esm/module_job:85:39) at link (node:internal/modules/esm/module_job:84:36)

pengzhanbo commented 1 month ago

麻烦告诉下我使用的 vuepress 以及 vuepress-theme-plume 的版本,node 版本、操作系统、以及 vuepress 的配置信息。如果有使用 typescript, 也给一下 tsconfig.json 的信息

当前给出的错误信息我不好判断是哪里出了问题。

Taebers commented 1 month ago

麻烦告诉下我使用的 vuepress 以及 vuepress-theme-plume 的版本,node 版本、操作系统、以及 vuepress 的配置信息。如果有使用 typescript, 也给一下 tsconfig.json 的信息

当前给出的错误信息我不好判断是哪里出了问题。

使用的软件版本如下: (vuepress版本使用的是与plume主题匹配的rc.9,使用最新的rc.11会提示依赖冲突) vuepress版本: "^2.0.0-rc.9" vuepress/bundler-vite版本: "^2.0.0-rc.9" vuepress-theme-plume版本: "^1.0.0-rc.56" node版本: v20.11.1 npm版本: 10.8.0 操作系统: macOS 14.5 vuepress配置文件config.js,内容如下:

import {defineUserConfig} from 'vuepress'
import {viteBundler} from '@vuepress/bundler-vite'
import {plumeTheme} from 'vuepress-theme-plume'

export default defineUserConfig({
  // 设置默认语言
  lang: 'zh-CN',
  theme: plumeTheme({
    avatar: {
      url:'./images/momoko.png',
      name: 'xxx',
      description: '不要做让自己后悔的事',
      circle: true
    },
    navbar: [
      {text: '首页', link: '/', icon: 'gravity-ui:house'},
      {text: '博客', link: '/blog/', icon: 'gravity-ui:square-article'},
      {text: '标签', link: '/blog/tags/', icon: 'gravity-ui:tag'},
      {text: '归档', link: '/blog/archives/', icon: 'gravity-ui:archive'},
    ]
  }),
  bundler: viteBundler()
})

感谢百忙之中抽空出来帮我查看问题~

pengzhanbo commented 1 month ago

看起来都很正常。另外需要确认的是,在构建产生报错后,在 .vuepress/.temp/internal 这个目录下,有没有一个 routes.js 的文件。

如果方便的话,在不涉及隐私下,是否可以将这个项目做一些精简处理,形成一个可重现该问题的 最小项目包,打包发送给我,我试着在本地重现下问题好方便排查具体原因。(请包含 package-lock.jsonyarn.lockpnpm-lock.yml 文件,这是保证我在本地安装的依赖能够跟你一致的前提)

Taebers commented 1 month ago

看起来都很正常。另外需要确认的是,在构建产生报错后,在 .vuepress/.temp/internal 这个目录下,有没有一个 routes.js 的文件。

如果方便的话,在不涉及隐私下,是否可以将这个项目做一些精简处理,形成一个可重现该问题的 最小项目包,打包发送给我,我试着在本地重现下问题好方便排查具体原因。(请包含 package-lock.jsonyarn.lockpnpm-lock.yml 文件,这是保证我在本地安装的依赖能够跟你一致的前提)

感谢您的帮助。 我在vuepress项目的issue下面看到了很多一些类似的问题,参考了这个解决方式,并且将vuepress的版本由文档推荐的2.0.0-rc.9修改到了最新版本2.0.0-rc.11,终于在执行npm run doc:build的时候构建成功。(虽然在进行npm install安装依赖的时候还是有版本冲突的warn警告) 初步推断应该是vuepress@2.0.0-rc.9版本本身的bug,再次感谢您的帮助。

pengzhanbo commented 1 month ago

其实我并不推荐升级到 2.0.0-rc.11,主题最近没跟进到新版本是有原因的,2.0.0-rc.11 存在一些 bug 会影响到实际的使用。

Taebers commented 1 month ago

我在您在另一个issue提到这个问题了,我暂且先使用这个版本过渡一下,期待vuepress和您的后续更新了。