【发布时间】:2022-02-16 20:51:28
【问题描述】:
我正在将 typeorm 与 nextjs 一起使用。不幸的是,使用手动迁移似乎很难开始工作。首先,我有以下 npm 脚本:
"typeorm": "ts-node -P cli-tsconfig.json -r tsconfig-paths/register ./node_modules/typeorm/cli.js --config ./config/typeorm.config.ts"
这让我可以运行:
npm run typeorm migration:run
它有效。但是,如果我想创建一个迁移,我会运行:
npm run typeorm migration:create -n mymigration
它失败并出现错误:
ts-node -P cli-tsconfig.json -r tsconfig-paths/register ./node_modules/typeorm/cli.js --config ./config/typeorm.config.ts “迁移:创建” “我的迁移”
compilerOptions 中缺少 baseUrl。 tsconfig-paths 将被跳过 bin.js 迁移:创建
创建一个新的迁移文件。
选项:-h, --help 显示帮助
[boolean] -c, --connection 运行 a 的连接的名称 询问。 [default: "default"] -n, --name 迁移类的名称。
[必需] -d, --dir 应该迁移的目录 创建的。 -f, --config 有连接的文件名 配置。 [default: "ormconfig"] -o, --outputJs 生成迁移文件 Javascript而不是 Typescript [boolean] [default: false] -v, --version 显示版本号
[布尔]缺少必需的参数:n npm ERR!代码 ELIFECYCLE npm 错误!错误号 1
显然它没有获取参数,但我不知道如何解决这个问题。
【问题讨论】:
-
这能回答你的问题吗? Sending command line arguments to npm script
标签: node.js npm next.js typeorm