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

Error when trying to run dev server with default React TS template #7684

Closed
7 tasks done
AltStuff opened this issue Apr 12, 2022 · 5 comments
Closed
7 tasks done

Error when trying to run dev server with default React TS template #7684

AltStuff opened this issue Apr 12, 2022 · 5 comments

Comments

@AltStuff
Copy link

AltStuff commented Apr 12, 2022

Describe the bug

Ran

yarn create vite

Picked React and typescript, also happens with react js

cd test
yarn
yarn dev

Throws errors

Doesn't happen with vanilla js nor typescript, only react

Reproduction

yarn create vite & cd test & yarn & yarn dev

System Info

System:
    OS: Windows 10 10.0.19043
    CPU: (16) x64 AMD Ryzen 7 4800H with Radeon Graphics
    Memory: 10.24 GB / 15.42 GB
  Binaries:
    Node: 17.9.0 - D:\tools\nvm\nodejs\node.EXE
    Yarn: 1.22.15 - D:\tools\nvm\nodejs\yarn.CMD
    npm: 8.5.5 - D:\tools\nvm\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (100.0.1185.36)
    Internet Explorer: 11.0.19041.1566
  npmPackages:
    @vitejs/plugin-react: ^1.0.7 => 1.3.0
    vite: ^2.9.0 => 2.9.1

Used Package Manager

yarn

Logs

$ vite

  vite v2.9.1 dev server running at:

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

  ready in 271ms.

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

10:49:37 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 inconsi    at failureErrorWithLog (D:\projects\web-projects\test\node_modules\esbuild\lib\main.js:1603:15)
    at D:\projects\web-projects\test\node_modules\esbuild\lib\main.js:1249:28
    at runOnEndCallbacks (D:\projects\web-projects\test\node_modules\esbuild\lib\main.js:1034:63)
    at buildResponseToResult (D:\projects\web-projects\test\node_modules\esbuild\lib\main.js:1247:7)
    at D:\projects\web-projects\test\node_modules\esbuild\lib\main.js:666:9
    at Socket.readFromStdout (D:\projects\web-projects\test\node_modules\esbuild\lib\main.js:632:7)
    at Socket.emit (events.js:321:20)
    at addChunk (_stream_readable.js:294:12)

Validations

@houxd1992
Copy link

i have same error , why u close this issue ? how to fix it

@bluwy
Copy link
Member

bluwy commented Apr 12, 2022

Duplicate of #7683

@bluwy bluwy marked this as a duplicate of #7683 Apr 12, 2022
@JoaoDanielRamos
Copy link

Everyone is having this issue, waiting for a patch or something.

@songyu641660583
Copy link

我也遇到这个问题,请问怎么解决呢

@patak-dev
Copy link
Member

For reference, esbuild 0.14.36 is out reverting the problematic change. Update esbuild in your projects and this is issue will be solved

@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

6 participants