Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't run "npm run dev" right after creating a new react-ts project. #7688

Closed
7 tasks done
JoaoDanielRamos opened this issue Apr 12, 2022 · 3 comments
Closed
7 tasks done

Comments

@JoaoDanielRamos
Copy link

Describe the bug

✘ [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.

✘ [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.

11:16:59 PM [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 (/Users/hotdawng/Desktop/viteTest/pleaseWork/node_modules/esbuild/lib/main.js:1603:15)
at /Users/hotdawng/Desktop/viteTest/pleaseWork/node_modules/esbuild/lib/main.js:1249:28
at runOnEndCallbacks (/Users/hotdawng/Desktop/viteTest/pleaseWork/node_modules/esbuild/lib/main.js:1034:63)
at buildResponseToResult (/Users/hotdawng/Desktop/viteTest/pleaseWork/node_modules/esbuild/lib/main.js:1247:7)
at /Users/hotdawng/Desktop/viteTest/pleaseWork/node_modules/esbuild/lib/main.js:1356:14
at /Users/hotdawng/Desktop/viteTest/pleaseWork/node_modules/esbuild/lib/main.js:666:9
at handleIncomingPacket (/Users/hotdawng/Desktop/viteTest/pleaseWork/node_modules/esbuild/lib/main.js:763:9)
at Socket.readFromStdout (/Users/hotdawng/Desktop/viteTest/pleaseWork/node_modules/esbuild/lib/main.js:632:7)
at Socket.emit (node:events:394:28)
at addChunk (node:internal/streams/readable:312:12)

Reproduction

https://stackblitz.com/edit/vitejs-vite-f3xqhq?file=index.html&terminal=dev

System Info

System:
    OS: macOS 12.1
    CPU: (4) x64 Intel(R) Core(TM) i5-7267U CPU @ 3.10GHz
    Memory: 78.41 MB / 8.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.3.0 - /usr/local/bin/node
    npm: 8.3.0 - /usr/local/bin/npm
  Browsers:
    Chrome: 100.0.4896.75
    Safari: 15.2
  npmPackages:
    @vitejs/plugin-react: ^1.0.7 => 1.3.0 
    vite: ^2.9.0 => 2.9.1

Used Package Manager

npm

Logs

No response

Validations

@juanka13v
Copy link

same error

@bompus
Copy link
Contributor

bompus commented Apr 12, 2022

Duplicate of #7683

@DevCay
Copy link

DevCay commented Apr 12, 2022

I have the same error.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants