【问题标题】:How to fix "must be declared in an enclosing class" error in Deno?如何修复 Deno 中的“必须在封闭类中声明”错误?
【发布时间】:2021-12-14 03:56:03
【问题描述】:

我编译了我的 deno 应用程序,但在我的一台服务器上出现此错误:

$ ./api                                                        
error: Uncaught SyntaxError: Private field '#h1' must be declared in an enclosing class
    at file://$deno$/bundle.js:3004:16

另外两台服务器运行良好。

其他服务器正在运行 Ubuntu 20.04.3 LTS

deno -V 是 1.15.3

【问题讨论】:

    标签: deno


    【解决方案1】:

    所以我必须通过 -r 标志来重新编译打字稿

    $ deno compile --allow-all --unstable -r --no-check --output ./api ./index.ts

    现在运行

    【讨论】:

    • 如果您必须通过 -r 让我相信您或您的依赖项之一正在使用未标记的导入,因此其中一台服务器正在获取更新版本的 deps 或类似的东西,其他要留意。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-17
    • 1970-01-01
    • 2021-04-11
    • 1970-01-01
    • 2014-06-14
    相关资源
    最近更新 更多