【发布时间】:2020-09-17 14:23:19
【问题描述】:
我有typescriptproject 并在项目中创建以下ormconfig.js 文件。
module.exports = {
type: 'mysql',
host: 'db',
port: 3306,
username: 'root',
password: 'test',
database: 'db',
entities: ['dist/entities/**/*.entity.js'],
migrations: ['dist/migrations/develop/**/*.js'],
logging: true,
};
在我的项目下面tsconfig.json 也创建在项目目录中。
{
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"target": "es2017",
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
"incremental": true
}
}
之后
npm run build
.ts被编译到以下目录。
-dist
-migrations
-develop
-entities
-entity1.js
-entity2.js
然后我尝试关注typeormmigration
npm run typeorm migration:create -- -n migration
生成迁移文件的根目录不是指定的迁移目录。
ormconfig.js 好像没有指定。
package.json 正在关注
"typeorm": "ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js --config ormconfig.js"
错在哪里? 我该如何解决?
谢谢
【问题讨论】:
标签: javascript node.js typescript nestjs typeorm