vite: Inconsistent Metadata errors
Describe the bug
I get this when starting my dev server
✘ [ERROR] [plugin vite:dep-pre-bundle] Detected inconsistent metadata for the path "node_modules/vue/dist/vue.runtime.esm-bundler.js" when it was imported here:
node_modules/vue-router/dist/vue-router.esm-bundler.js:6:187:
6 │ ...eactive, 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/dist/vue.runtime.esm-bundler.js"
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The difference in metadata is displayed below:
{
- "pluginName": null,
+ "pluginName": "vite:dep-pre-bundle",
}
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.
Possible duplicate of https://github.com/vitejs/vite/issues/7683
Reproduction
https://stackblitz.com/edit/vitejs-vite-f48pac?file=package.json
System Info
System:
OS: macOS 12.0.1
CPU: (8) arm64 Apple M1
Memory: 95.61 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.13.1 - ~/.volta/tools/image/node/16.13.1/bin/node
Yarn: 1.22.17 - ~/.volta/tools/image/yarn/1.22.17/bin/yarn
npm: 8.6.0 - ~/.volta/tools/image/npm/8.6.0/bin/npm
Browsers:
Chrome: 100.0.4896.75
Safari: 15.1
npmPackages:
@vitejs/plugin-vue: ^2.3.1 => 2.3.1
vite: ^2.9.1 => 2.9.1
Used Package Manager
yarn
Logs
vite:resolve 0.31ms @vue/runtime-dom -> /Users/k/fume/tailvue/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js +0ms
vite:resolve 0.41ms vue -> /Users/k/fume/tailvue/node_modules/vue/dist/vue.runtime.esm-bundler.js +3ms
✘ [ERROR] [plugin vite:dep-pre-bundle] Detected inconsistent metadata for the path "node_modules/vue/dist/vue.runtime.esm-bundler.js" when it was imported here:
node_modules/@iconify/vue/dist/iconify.mjs:1:35:
1 │ import { h, defineComponent } 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/dist/vue.runtime.esm-bundler.js"
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The difference in metadata is displayed below:
{
- "pluginName": null,
+ "pluginName": "vite:dep-pre-bundle",
}
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.
vite:resolve 0.33ms @vue/runtime-core -> /Users/k/fume/tailvue/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js +1ms
vite:resolve 0.27ms @vue/shared -> /Users/k/fume/tailvue/node_modules/@vue/shared/dist/shared.esm-bundler.js +0ms
vite:resolve 0.39ms @vue/reactivity -> /Users/k/fume/tailvue/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js +10ms
11:03:58 PM [vite] error while updating dependencies:
Error: Build failed with 1 error:
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it’s a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 12
- Comments: 24 (2 by maintainers)
The issue seems related to
esbuild
A temporary workaround is to add
resolution
to your package.json:Thank man 👍!
Thank you, works.
Also, i’m using
npm
notyarn
so if anyone comes here usingnpm
, fyi its equivalent isoverrides
原因是vite的依赖包esbuild今天上午发布了一个新版本0.14.35,有问题。0.14.34是没问题的。简单来说,resolutions是yarn的固定版本的一个方法。刚刚,esbuild又发布了一个新版本0.14.36,解决了这个问题
Please remove the custom resolutions, esbuild 0.14.36 has been released reverting the problematic change
Happens with VUE JS as well ` node_modules/.pnpm/vue-router@4.0.14_vue@3.2.31/node_modules/vue-router/dist/vue-router.esm-bundler.js:6:187: 6 │ …t, 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:
The difference in metadata is displayed below:
{
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.
下午12:21:14 [vite] error while updating dependencies: Error: Build failed with 1 error: node_modules/.pnpm/vue-router@4.0.14_vue@3.2.31/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/.pnpm/vue@3.2.31/node_modules/vue/dist/vue.runtime.esm-bundler.js” when it was imported here: at failureErrorWithLog (E:\demo\2022\my-vue-app\node_modules.pnpm\esbuild@0.14.35\node_modules\esbuild\lib\main.js:1603:15) at E:\demo\2022\my-vue-app\node_modules.pnpm\esbuild@0.14.35\node_modules\esbuild\lib\main.js:1249:28 at runOnEndCallbacks (E:\demo\2022\my-vue-app\node_modules.pnpm\esbuild@0.14.35\node_modules\esbuild\lib\main.js:1034:63) at buildResponseToResult (E:\demo\2022\my-vue-app\node_modules.pnpm\esbuild@0.14.35\node_modules\esbuild\lib\main.js:1247:7) at E:\demo\2022\my-vue-app\node_modules.pnpm\esbuild@0.14.35\node_modules\esbuild\lib\main.js:1356:14 at E:\demo\2022\my-vue-app\node_modules.pnpm\esbuild@0.14.35\node_modules\esbuild\lib\main.js:666:9 at handleIncomingPacket (E:\demo\2022\my-vue-app\node_modules.pnpm\esbuild@0.14.35\node_modules\esbuild\lib\main.js:763:9) at Socket.readFromStdout (E:\demo\2022\my-vue-app\node_modules.pnpm\esbuild@0.14.35\node_modules\esbuild\lib\main.js:632:7) at Socket.emit (node:events:390:28) at addChunk (node:internal/streams/readable:315:12) Vite Error, /node_modules/.vite/deps/vue-router.js?v=18f23ae8 optimized info should be defined X [ERROR] [plugin vite:dep-pre-bundle] Detected inconsistent metadata for the path “node_modules/.pnpm/vue@3.2.31/node_modules/vue/dist/vue.runtime.esm-bundler.js” when it was imported here:
The original metadata for that path comes from when it was imported here:
The difference in metadata is displayed below:
{
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.
下午12:21:19 [vite] error while updating dependencies: Error: Build failed with 1 error: node_modules/.pnpm/vue-router@4.0.14_vue@3.2.31/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/.pnpm/vue@3.2.31/node_modules/vue/dist/vue.runtime.esm-bundler.js” when it was imported here: at failureErrorWithLog (E:\demo\2022\my-vue-app\node_modules.pnpm\esbuild@0.14.35\node_modules\esbuild\lib\main.js:1603:15) at E:\demo\2022\my-vue-app\node_modules.pnpm\esbuild@0.14.35\node_modules\esbuild\lib\main.js:1249:28 at runOnEndCallbacks (E:\demo\2022\my-vue-app\node_modules.pnpm\esbuild@0.14.35\node_modules\esbuild\lib\main.js:1034:63) at buildResponseToResult (E:\demo\2022\my-vue-app\node_modules.pnpm\esbuild@0.14.35\node_modules\esbuild\lib\main.js:1247:7) at E:\demo\2022\my-vue-app\node_modules.pnpm\esbuild@0.14.35\node_modules\esbuild\lib\main.js:1356:14 at E:\demo\2022\my-vue-app\node_modules.pnpm\esbuild@0.14.35\node_modules\esbuild\lib\main.js:666:9 at handleIncomingPacket (E:\demo\2022\my-vue-app\node_modules.pnpm\esbuild@0.14.35\node_modules\esbuild\lib\main.js:763:9) at Socket.readFromStdout (E:\demo\2022\my-vue-app\node_modules.pnpm\esbuild@0.14.35\node_modules\esbuild\lib\main.js:632:7) at Socket.emit (node:events:390:28) at addChunk (node:internal/streams/readable:315:12) `
Happens with React JS and React TS as well