react-dom 已安装,但未找到。 `无法在路径中找到模块:'react-dom/client' 相对于`

react-dom installed, but not found. `Could not find module in path: 'react-dom/client' relative to`

Here is the Codesandbox

我想 运行 休息一下,但是 Tests 选项卡显示此错误。

Could not find module in path: 'react-dom/client' relative to
'/node_modules/@testing-library/react/dist/@testing-library/react.esm.js'

我参考了这些,但它们没有解决我的问题。

  1. 正在 devDependencies https://github.com/codesandbox/codesandbox-client/issues/2276
  2. 中重新安装它
  3. 关闭我的 UBlock 来源。 https://github.com/enzymejs/enzyme/issues/529
  4. 尝试不同的浏览器

我应该怎么做才能成功运行这个测试?

这是一个已知问题。 答案说你需要使用终端来 运行 这个。终端就在预览下方 window.

https://github.com/codesandbox/codesandbox-client/issues/6599

Hey @eps1lon - Thank you for flagging this, the tests unfortunately don't work within Server sandboxes and we'll be removing them soon. To run the tests you'll need to use the terminal. Sorry for the trouble!