首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Vite - esbuildx.x.x与vite不匹配。

Vite - esbuildx.x.x与vite不匹配。
EN

Stack Overflow用户
提问于 2022-07-20 03:47:48
回答 1查看 66关注 0票数 1

问题

今天启动服务器时,我使用vite创建了一个React项目,更新后遇到了这个错误。

X [ERROR] [plugin vite:dep-pre-bundle] Detected inconsistent metadata for the path "node_modules/react/index.js" when it was imported here:

我使用的是vite版本2.9.1

问题的细节

代码语言:javascript
复制
  vite v2.9.1 dev server running at:

  > Local: http://localhost:3000/
  > Network: use `--host` to expose

  ready in 234ms.

X [ERROR] [plugin vite:dep-pre-bundle] Detected inconsistent metadata for the path "node_modules/react/index.js" when it was imported here:

    node_modules/react/cjs/react-jsx-dev-runtime.development.js:16:20:
      16 │ var React = require('react');
         ╵                     ~~~~~~~

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

    dep:react:1:23:
      1 │ export default require("./node_modules/react/index.js");
        ╵                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  The difference in metadata is displayed below:
  
   {
  -  "pluginName": null,
  +  "pluginName": "vite:dep-pre-bundle",
   }

系统信息

代码语言:javascript
复制
System:
    OS: macOS 12.2.1
    CPU: (4) x64 Intel(R) Core(TM) i5-7600 CPU @ 3.50GHz
    Memory: 426.07 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 17.9.0 - /usr/local/bin/node
    Yarn: 1.22.17 - ~/.config/yarn/global/node_modules/.bin/yarn
    npm: 8.5.5 - /usr/local/bin/npm
  Browsers:
    Chrome: 100.0.4896.75
    Edge: 100.0.1185.39
    Safari: 15.3
  npmPackages:
    @vitejs/plugin-vue: ^2.3.0 => 2.3.1 
    vite: 2.9.1 => 2.9.1
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-10-31 09:16:52

这个问题是关于“建立”的。

https://github.com/vitejs/vite/issues/7683

你可以修好它,快跑

代码语言:javascript
复制
yarn update esbuild // or npm update esbuild
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73045775

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档