【问题标题】:TypeError: Cannot set property EntityManager of #<Object> which has only a getterTypeError:无法设置只有 getter 的 #<Object> 的属性 EntityManager
【发布时间】:2020-05-16 11:11:46
【问题描述】:

我对使用 Typeorm 很陌生,当我尝试建立连接时出现错误:

export {EntityManager} from "./entity-manager/EntityManager";
        ^
TypeError: Cannot set property EntityManager of #<Object> which has only a getter

typeorm 版本 => "typeorm": "0.2.21",

我尝试将 typeorm 降级到 0.2.0,但后来我的 postgres 版本出现问题。 其他人有同样的问题吗?

【问题讨论】:

  • 我昨天遇到了同样的问题。但它没有问题......这发生在我运行“npm install --no-shrinkwrap --production”时。
  • 检查这个:Entity manager Node.js

标签: typeorm


【解决方案1】:

问题似乎出在typeorm 使用的tslib 1.12 上。建议暂时降级。

相关问题:Can't init TypeORM project

【讨论】:

  • 所以当我降级时,我得到一个不同的错误:错误:错误:列 cnst.consrc 不存在使用 tyorm@0.2.0 和 postgres 11.7
  • 实际上,它确实适用于上面帖子中的解决方法,谢谢!
【解决方案2】:

最后我解决了使用 npm install --productiontaking off --no-shrinkwrap 编译应用程序的问题

只需复制 package.json 和 package-lock.json。

我正在使用最新的 typeorm。

【讨论】:

    猜你喜欢
    • 2020-08-29
    • 1970-01-01
    • 1970-01-01
    • 2022-07-27
    • 1970-01-01
    • 1970-01-01
    • 2019-04-09
    • 2020-09-26
    • 2021-05-31
    相关资源
    最近更新 更多