【问题标题】:How could I fix Error during compodoc run in angular?在以角度运行 compodoc 期间如何修复错误?
【发布时间】:2021-06-20 13:14:36
【问题描述】:

在此处输入代码>块引用

在 compodoc 以 Angular 运行时出现下一个错误 (npx compodoc -p tsconfig.app.json src)

我该如何解决?

Ooops error during main graph generation, moving on next part with main graph disabled : : Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /usr/local/lib/node_modules/@compodoc/compodoc/node_modules/@aduh95/viz.js/sync/index.js
    require() of ES modules is not supported.
    require() of /usr/local/lib/node_modules/@compodoc/compodoc/node_modules/@aduh95/viz.js/sync/index.js from /usr/local/lib/node_modules/@compodoc/compodoc/node_modules/@compodoc/ngd-transformer/dist/engines/dot/dot.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
    Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /usr/local/lib/node_modules/@compodoc/compodoc/node_modules/@aduh95/viz.js/package.json.

【问题讨论】:

    标签: angular compodoc


    【解决方案1】:

    我有同样的问题。我将 Node 版本从 12.16.3 更新到 14.16.1 并修复了它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-10-31
      • 2019-12-12
      • 2020-06-27
      • 1970-01-01
      • 2023-03-20
      • 1970-01-01
      • 2017-10-16
      相关资源
      最近更新 更多