vuejs / vitepress

Vite & Vue powered static site generator.
https://vitepress.dev
MIT License
11.48k stars 1.86k forks source link

运行项目时失败 #3487

Closed dj835638078 closed 3 months ago

dj835638078 commented 3 months ago

Describe the bug

在learn中通过 yarn add --dev vitepress 安装并配置后,在运行时报错: 1、(node:20568) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time (Use node --trace-warnings ... to show where the warning was created) 2、[ERROR] No matching export in "node_modules/vitepress/node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "default" 3、[ERROR] No matching export in "node_modules/vue-demi/lib/index.mjs" for import "set"

Reproduction

使用的vitepress版本号为:^1.0.0-rc.39

Expected behavior

运行命令:yarn docs:dev

System Info

"lerna": "^5.5.0",
"vitepress": "^1.0.0-rc.39"

Additional context

No response

Validations

dj835638078 commented 3 months ago

我已经删除了node_modules,也删除了cache,重新yarn了

brc-dd commented 3 months ago

Please provide a reproducible example in form of a GitHub repo or using https://vitepress.new

Also, share your system details like which OS and yarn version are you using.

dj835638078 commented 3 months ago

node版本为v18.0.0, yarn 版本为1.22.19

dj835638078 commented 3 months ago

window/google chrome

Zhengqbbb commented 3 months ago

Please provide a reproducible example https://vitepress.new/

给一个最小化复现的例子,我们来找出这些问题 PS: node 的版本既然是 18,那么应该升级到稳定的 v18.19.0 我记得 v18.0.0 在打包的时候会导致包体积过大的问题

dj835638078 commented 3 months ago

Please provide a reproducible example https://vitepress.new/

给一个最小化复现的例子,我们来找出这些问题 PS: node 的版本既然是 18,那么应该升级到稳定的 v18.19.0 我记得 v18.0.0 在打包的时候会导致包体积过大的问题

是在lerna项目中集成的vitepress,里面有多个组件,不好复现。用了node v18.19.0,还是报错: X [ERROR] No matching export in "node_modules/vue-demi/lib/index.mjs" for import "set"

node_modules/@vueuse/shared/index.mjs:1:247:
  1 │ ...computed, reactive, toRefs as toRefs$1, toRef as toRef$1, isVue2, set as set$1, onBeforeMount, nextTick, onBeforeUnmount, onMounted, on...
    ╵                                                                      ~~~

X [ERROR] No matching export in "node_modules/vue-demi/lib/index.mjs" for import "set"

node_modules/@vueuse/core/index.mjs:3:276:
  3 │ ... onMounted, readonly, nextTick, reactive, markRaw, unref, getCurrentScope, isVue2, set, del, isReadonly, onBeforeUpdate } from 'vue-demi'; 
    ╵                                                                                       ~~~

X [ERROR] No matching export in "node_modules/vue-demi/lib/index.mjs" for import "del"

node_modules/@vueuse/core/index.mjs:3:281:
  3 │ ... onMounted, readonly, nextTick, reactive, markRaw, unref, getCurrentScope, isVue2, set, del, isReadonly, onBeforeUpdate } from 'vue-demi'; 
brc-dd commented 3 months ago

It seems to me you're trying to use vue 2 code somewhere. Unfortunately we can't help more without looking at the code.

dj835638078 commented 3 months ago

It seems to me you're trying to use vue 2 code somewhere. Unfortunately we can't help more without looking at the code.

能兼容vue2代码吗?

brc-dd commented 3 months ago

No. VitePress doesn't support vue 2.

dj835638078 commented 3 months ago

No. VitePress doesn't support vue 2.

组件中的代码也不能用vue吗?在vitepress中的代码用了vue2

brc-dd commented 3 months ago

I'm not sure if I'm getting the translations right, but VitePress doesn't use vue 2. Either your custom components are using it or you have listed vue 2 as dependency.

dj835638078 commented 3 months ago

vue 2 as dependency.

不好意思,前面说错了,因为用的lerna搭建的组件库,所以前期会有部分组件是用vue2实现的。但是在vitepress中,代码的实现都是用的vue3

heerxingen commented 3 months ago

No. VitePress doesn't support vue 2.

组件中的代码也不能用vue吗?在vitepress中的代码用了vue2

image image maybe this will help you? 或许这个会帮你