TypeORM + TypeError:无法设置 #<Object> 的属性 EntityManager它只有一个吸气剂 [英] TypeORM + TypeError: Cannot set property EntityManager of #<Object> which has only a getter
问题描述
由于以下异常,我有一个 Nest 应用程序无法启动.我不确定问题的原因是什么.
I have a Nest application which is not starting due to the following exception. I am not sure what is the cause of the problem.
我创建了这个 GitHub 存储库来复制这个问题.README 中有详细的运行说明.
I created this GitHub repository to replicate the issue. The running instructions are detailed in the README.
错误:
TypeError: Cannot set property EntityManager of #<Object> which has only a getter
at Object.<anonymous> (/Users/saulo/NodeProjects/typeorm-jest-issues/node_modules/typeorm/index.js:120:23)
at Module._compile (internal/modules/cjs/loader.js:1147:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
at Module.load (internal/modules/cjs/loader.js:996:32)
at Function.Module._load (internal/modules/cjs/loader.js:896:14)
at Module.require (internal/modules/cjs/loader.js:1036:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/Users/saulo/NodeProjects/typeorm-jest-issues/node_modules/@nestjs/typeorm/dist/common/typeorm.utils.js:5:19)
at Module._compile (internal/modules/cjs/loader.js:1147:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
推荐答案
tslib 依赖项似乎存在问题.您可以在此处找到更多信息:
There seems to be an issue with the tslib dependency. You can find more info here:
https://github.com/typeorm/typeorm/issues/6054
但是启动项目的临时解决方案是将 tslint@1.11.2 添加为依赖项(yarn add tslib@1.11.2
)并将其添加到 package.json
But a temporary solution to start your project is to add tslint@1.11.2 as a dependency (yarn add tslib@1.11.2
) and to add this to your package.json
"resolutions": {
"tslib": "1.11.2"
}
这篇关于TypeORM + TypeError:无法设置 #<Object> 的属性 EntityManager它只有一个吸气剂的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!