无法初始化 TypeORM 项目 [英] Can't init TypeORM project

查看:49
本文介绍了无法初始化 TypeORM 项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 TypeORM 文档,我正在尝试创建一个新的 TypeORM 项目并运行以下命令:

I'm trying to create a new TypeORM project and have run the following commands, according to the TypeORM documentation:

npm install typeorm -g

typeorm init --name MyProject --database postgres

我收到此错误:

TypeError: Cannot set property EntityManager of #<Object> which has only a getter
at Object.<anonymous> (~/.npm-global/lib/node_modules/typeorm/index.js:120:23)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (~/.npm-global/lib/node_modules/typeorm/commands/SchemaSyncCommand.js:4:15)
at Module._compile (internal/modules/cjs/loader.js:778:30)

即使我只是尝试运行,我也会遇到同样的错误

I get the same error even if I just try to run

typeorm

推荐答案

添加

"resolutions": { 
    "tslib": "1.11.2"
}

到你的包 json,tslib 1.12 打破了 typeorm

to your package json, tslib 1.12 breaks typeorm

这篇关于无法初始化 TypeORM 项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆