0
0

More than 1 year has passed since last update.

【typeorm】「オプションではない引数が 0 個では不足しています。少なくとも 1 個の引数が必要です」のエラー

Posted at

やろうとしていたこと

Expressとtypeorm使って、学習がてら個人開発してました。
entityを作ろうと思って、下記コマンドを叩いたら、

$  npx typeorm entity:create -n User

typeorm entity:create <path>

Generates a new entity.

オプション:
  -h, --help     ヘルプを表示                                             [真偽]
  -v, --version  バージョンを表示                                         [真偽]

オプションではない引数が 0 個では不足しています。少なくとも 1 個の引数が必要です:

タイトルのエラーが出ました。
引数が足りないって、どういうこっちゃ。公式に書いてある通りに叩いているのなんでエラーでるんだ?

原因

ヘルプオプションをつけて調べてみたところ、

$ npx typeorm entity:create -h

オプション:
  -h, --help        ヘルプを表示                                          [真偽]
  -c, --connection  Name of the connection on which to run a query
                                                         [デフォルト: "default"]
  -n, --name        Name of the entity class.                             [必須]
  -d, --dir         Directory where entity should be created.
  -f, --config      Name of the file with connection configuration.
                                                       [デフォルト: "ormconfig"]
  -v, --version     バージョンを表示                                      [真偽]

-d, --dir Directory where entity should be created.というのが怪しいな
(エンティティーファイルを作るディレクトリを指定しないとだめか?)と思い、

$ typeorm entity:create -n User -d src/entity

を叩いてみたが、やはり結果は変わりませんでした。
公式ドキュメントを読んでも、詳しく書いていませんでした。

結局、原因はわかりませんでした。
もし、わかる方いましたら、教えてください。

対処法

下記バージョンに下げる。これで再度npm iすればとりあえずファイルは出来ました。

0.3.7

0.2.37

参考にした記事

0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0