5

I create a react app with Vite, I go to the directory with cd xxxxx, I run npm install, then I follow npm run dev Please help me, I dont want to use Create-react-app is to slow. I have been searchin in blogs and nothing works, i have updated node.js, deprecated vite, deleted vite cache, uninstalled node, uninstalled VScode

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",
   }

  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.

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-dom/cjs/react-dom.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",
   }

  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:08:07 a. m. [vite] error while updating dependencies:
Error: Build failed with 2 errors:
node_modules/react-dom/cjs/react-dom.development.js:16:20: 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: ERROR: [plugin: vite:dep-pre-bundle] Detected inconsistent metadata for the path "node_modules/react/index.js" when it was imported here:
    at failureErrorWithLog (C:\Users\feedm\Desktop\front\node_modules\esbuild\lib\main.js:1603:15)
    at C:\Users\feedm\Desktop\front\node_modules\esbuild\lib\main.js:1249:28
    at runOnEndCallbacks (C:\Users\feedm\Desktop\front\node_modules\esbuild\lib\main.js:1034:63)
    at buildResponseToResult (C:\Users\feedm\Desktop\front\node_modules\esbuild\lib\main.js:1247:7)
    at C:\Users\feedm\Desktop\front\node_modules\esbuild\lib\main.js:1356:14
    at C:\Users\feedm\Desktop\front\node_modules\esbuild\lib\main.js:666:9
    at handleIncomingPacket (C:\Users\feedm\Desktop\front\node_modules\esbuild\lib\main.js:763:9)
    at Socket.readFromStdout (C:\Users\feedm\Desktop\front\node_modules\esbuild\lib\main.js:632:7)
    at Socket.emit (node:events:526:28)
    at addChunk (node:internal/streams/readable:315:12)
0

4 Answers 4

6

This was caused by esbuild#2177 (on which Vite depends), which was just recently reverted in esbuild version 0.14.36.

This issue should no longer occur with Vite, but you'll have to delete any lockfiles (i.e., package-lock.json, yarn.lock, etc.) and node_modules/, and re-install dependencies, as reported here.

Sign up to request clarification or add additional context in comments.

Comments

3

I had this problem when I installed new package vie-owl-carousel.

 yarn add vue-owl-carousel

When I removed it by yarn

 yarn remove vue-owl-carousel

This error showed to me.

12:08:07 a. m. [vite] error while updating dependencies:
Error: Build failed with 2 errors:...

I installed it again and app ran successfully. Then I removed it by npm uninstall and the problem solved.

Comments

1

There is a Github issue open for this. For now I was able to resolve by locking the package.json version of Vite to "vite": "~2.7.1"

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

Comments

0

I had a similar error, and I was using vuejs3 and vite 4.x, to solve this problem I had to run npm outdated to see if there were any updates, and after I I had to reinstall only the esbuild by doing npm i esbuild https://www.npmjs.com/package/esbuild?activeTab=explore

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.