错误:预期内容密钥 de1e4a02ec63c4eb 存在,在 React 中出现此错误。我正在使用包裹作为捆绑器

问题描述 投票:0回答:1
  > 1 | import React from "react";
  >   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
    2 | import ReactDOM from "react-dom/client";
    3 |

  F:\react\index.html:11:1
    10 |
  > 11 | <script  src="./app.js"></script>
  >    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The environment was originally created here
    12 | </body>
    13 | </html>

  💡 Add the type="module" attribute to the <script> tag.
  📝 Learn more: https://parceljs.org/languages/javascript/#classic-scripts


 after adding type='module' this showing the error


Error: Expected content key de1e4a02ec63c4eb to exist

  Error: Expected content key de1e4a02ec63c4eb to exist
      at nullthrows (F:\react\node_modules\nullthrows\nullthrows.js:7:15)
      at AssetGraph.getNodeIdByContentKey (F:\react\node_modules\@parcel\graph\lib\ContentGraph.js:67:38)
      at F:\react\node_modules\@parcel\core\lib\SymbolPropagation.js:52:82
      at Array.map (<anonymous>)
      at propagateSymbols (F:\react\node_modules\@parcel\core\lib\SymbolPropagation.js:52:61)
      at AssetGraphBuilder.build (F:\react\node_modules\@parcel\core\lib\requests\AssetGraphRequest.js:168:62)
      at async Object.run (F:\react\node_modules\@parcel\core\lib\requests\AssetGraphRequest.js:60:37)
      at async RequestTracker.runRequest (F:\react\node_modules\@parcel\core\lib\RequestTracker.js:633:20)
      at async Object.run (F:\react\node_modules\@parcel\core\lib\requests\BundleGraphRequest.js:103:11)
      at async RequestTracker.runRequest (F:\react\node_modules\@parcel\core\lib\RequestTracker.js:633:20)

我该如何解决这个问题?

parcel版本是2.9.3

我尝试删除缓存,也尝试重新创建整个项目,但什么也没发生。

reactjs parcel
1个回答
0
投票

如果您正在使用parcel,请尝试删除“.parcel-cache”文件夹。然后重新运行构建。

© www.soinside.com 2019 - 2024. All rights reserved.