vuepress / core

Vue-Powered Static Site Generator
https://vuepress.vuejs.org
MIT License
2.3k stars 923 forks source link

[Bug report] Following the get started steps don't work out of the box #810

Closed ctwhome closed 2 years ago

ctwhome commented 2 years ago

Bug report

Description

Steps to reproduce

Simply follow the steps here https://v2.vuepress.vuejs.org/guide/getting-started.html#manual-installation and I get the following errors when running yarn:dev

Environment info

Console error

 $ yarn docs:dev  
yarn run v1.22.17
$ vuepress dev docs
info Initializing VuePress and preparing data...

  vite v2.9.1 dev server running at:

  > Local:    http://localhost:8080/
  > Network:  http://192.168.31.244:8080/
  > Network:  http://192.168.1.14:8080/
✘ [ERROR] [plugin vite:dep-pre-bundle] Detected inconsistent metadata for the path "node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js" when it was imported here:

    node_modules/vue-router/dist/vue-router.esm-bundler.js:6:187:
      6 │ ...inject, onUnmounted, onDeactivated, onActivated, computed, unref, watchEffect, defineComponent, reactive, h, provide, ref, watch, shallowRef, nextTick } from 'vue';
        ╵                                                                                                                                                                  ~~~~~

  The original metadata for that path comes from when it was imported here:

    dep:vue:2:14:
      2 │ export * from "../../../../node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js"
        ╵               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  The difference in metadata is displayed below:

   {
  -  "pluginName": null,
  -  "sideEffects": true,
  +  "pluginName": "vite:dep-pre-bundle",
  +  "sideEffects": false,
   }

  This is a bug in the "vite:dep-pre-bundle" plugin. Plugins provide metadata for a given path in an
  "onResolve" callback. All metadata provided for the same path must be consistent to ensure
  deterministic builds. Due to parallelism, one set of provided metadata will be randomly chosen for
  a given path, so providing inconsistent metadata for the same path can cause non-determinism.

✘ [ERROR] [plugin vite:dep-pre-bundle] Detected inconsistent metadata for the path "node_modules/@vue/devtools-api/lib/esm/index.js" when it was imported here:

    node_modules/vue-router/dist/vue-router.esm-bundler.js:7:36:
      7 │ import { setupDevtoolsPlugin } from '@vue/devtools-api';
        ╵                                     ~~~~~~~~~~~~~~~~~~~

  The original metadata for that path comes from when it was imported here:

    dep:@vue_devtools-api:2:14:
      2 │ export * from "../../../../node_modules/@vue/devtools-api/lib/esm/index.js"
        ╵               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  The difference in metadata is displayed below:

   {
  -  "pluginName": null,
  -  "sideEffects": true,
  +  "pluginName": "vite:dep-pre-bundle",
  +  "sideEffects": false,
   }

  This is a bug in the "vite:dep-pre-bundle" plugin. Plugins provide metadata for a given path in an
  "onResolve" callback. All metadata provided for the same path must be consistent to ensure
  deterministic builds. Due to parallelism, one set of provided metadata will be randomly chosen for
  a given path, so providing inconsistent metadata for the same path can cause non-determinism.

✘ [ERROR] [plugin vite:dep-pre-bundle] Detected inconsistent metadata for the path "node_modules/@vueuse/core/index.mjs" when it was imported here:

    node_modules/@vueuse/core/index.mjs:4:111:
      4 │ import { unrefElement as unrefElement$1, useEventListener as useEventListener$1, useRafFn as useRafFn$1 } from '@vueuse/core';
        ╵                                                                                                                ~~~~~~~~~~~~~~

  The original metadata for that path comes from when it was imported here:

    dep:@vueuse_core:2:14:
      2 │ export * from "../../../../node_modules/@vueuse/core/index.mjs"
        ╵               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  The difference in metadata is displayed below:

   {
  -  "pluginName": null,
  -  "sideEffects": true,
  +  "pluginName": "vite:dep-pre-bundle",
  +  "sideEffects": false,
   }

  This is a bug in the "vite:dep-pre-bundle" plugin. Plugins provide metadata for a given path in an
  "onResolve" callback. All metadata provided for the same path must be consistent to ensure
  deterministic builds. Due to parallelism, one set of provided metadata will be randomly chosen for
  a given path, so providing inconsistent metadata for the same path can cause non-determinism.

✘ [ERROR] [plugin vite:dep-pre-bundle] Detected inconsistent metadata for the path "node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js" when it was imported here:

    node_modules/vue-demi/lib/index.mjs:1:21:
      1 │ import * as Vue from 'vue'
        ╵                      ~~~~~

  The original metadata for that path comes from when it was imported here:

    dep:vue:2:14:
      2 │ export * from "../../../../node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js"
        ╵               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  The difference in metadata is displayed below:

   {
  -  "pluginName": null,
  -  "sideEffects": true,
  +  "pluginName": "vite:dep-pre-bundle",
  +  "sideEffects": false,
   }

  This is a bug in the "vite:dep-pre-bundle" plugin. Plugins provide metadata for a given path in an
  "onResolve" callback. All metadata provided for the same path must be consistent to ensure
  deterministic builds. Due to parallelism, one set of provided metadata will be randomly chosen for
  a given path, so providing inconsistent metadata for the same path can cause non-determinism.

✘ [ERROR] [plugin vite:dep-pre-bundle] Detected inconsistent metadata for the path "node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js" when it was imported here:

    node_modules/vue-demi/lib/index.mjs:27:14:
      27 │ export * from 'vue'
         ╵               ~~~~~

  The original metadata for that path comes from when it was imported here:

    dep:vue:2:14:
      2 │ export * from "../../../../node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js"
        ╵               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  The difference in metadata is displayed below:

   {
  -  "pluginName": null,
  -  "sideEffects": true,
  +  "pluginName": "vite:dep-pre-bundle",
  +  "sideEffects": false,
   }

  This is a bug in the "vite:dep-pre-bundle" plugin. Plugins provide metadata for a given path in an
  "onResolve" callback. All metadata provided for the same path must be consistent to ensure
  deterministic builds. Due to parallelism, one set of provided metadata will be randomly chosen for
  a given path, so providing inconsistent metadata for the same path can cause non-determinism.

8:53:32 AM [vite] error while updating dependencies:
Error: Build failed with 5 errors:
node_modules/@vueuse/core/index.mjs:4:111: ERROR: [plugin: vite:dep-pre-bundle] Detected inconsistent metadata for the path "node_modules/@vueuse/core/index.mjs" when it was imported here:
node_modules/vue-demi/lib/index.mjs:1:21: ERROR: [plugin: vite:dep-pre-bundle] Detected inconsistent metadata for the path "node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js" when it was imported here:
node_modules/vue-demi/lib/index.mjs:27:14: ERROR: [plugin: vite:dep-pre-bundle] Detected inconsistent metadata for the path "node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js" when it was imported here:
node_modules/vue-router/dist/vue-router.esm-bundler.js:6:187: ERROR: [plugin: vite:dep-pre-bundle] Detected inconsistent metadata for the path "node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js" when it was imported here:
node_modules/vue-router/dist/vue-router.esm-bundler.js:7:36: ERROR: [plugin: vite:dep-pre-bundle] Detected inconsistent metadata for the path "node_modules/@vue/devtools-api/lib/esm/index.js" when it was imported here:
    at failureErrorWithLog (/Users/ctw/Sites/github/escience/rsd/vuepress-starter/node_modules/esbuild/lib/main.js:1603:15)
    at /Users/ctw/Sites/github/escience/rsd/vuepress-starter/node_modules/esbuild/lib/main.js:1249:28
    at runOnEndCallbacks (/Users/ctw/Sites/github/escience/rsd/vuepress-starter/node_modules/esbuild/lib/main.js:1034:63)
    at buildResponseToResult (/Users/ctw/Sites/github/escience/rsd/vuepress-starter/node_modules/esbuild/lib/main.js:1247:7)
    at /Users/ctw/Sites/github/escience/rsd/vuepress-starter/node_modules/esbuild/lib/main.js:1356:14
    at /Users/ctw/Sites/github/escience/rsd/vuepress-starter/node_modules/esbuild/lib/main.js:666:9
    at handleIncomingPacket (/Users/ctw/Sites/github/escience/rsd/vuepress-starter/node_modules/esbuild/lib/main.js:763:9)
    at Socket.readFromStdout (/Users/ctw/Sites/github/escience/rsd/vuepress-starter/node_modules/esbuild/lib/main.js:632:7)
    at Socket.emit (node:events:526:28)
    at addChunk (node:internal/streams/readable:315:12)
Mister-Hope commented 2 years ago

I will have a look later, you can try npm init vuepress-theme-hope docs see if it works.

Mister-Hope commented 2 years ago

Oh I got why there is an issue here, VuePress2 is based on Vue3 and vite@2.9, which means you cannot have vue2 deps in your project.

meteorlxy commented 2 years ago

That's right. You should not use VuePress 2 in a Vue 2 project directly. Consider using a separated docs repository.

ctwhome commented 2 years ago

That's right. You should not use VuePress 2 in a Vue 2 project directly. Consider using a separated docs repository.

I am not using vue 2 at all. I installed it into a complete new folder. Including yarn in it.. Got in it... So that shouldn't be the problem

Mister-Hope commented 2 years ago

Try to provide a reproduction repo, as my npm init vuepress-theme-hope docs is working on my machine.