angularのバージョン
Angular: 14.0.0
Contents
ng generate componentを実行したら、More than one module matches.〜とエラーが出た
発生エラー
% ng generate component phone
More than one module matches. Use the '--skip-import'
option to skip importing the component into the closest module or use the module option to specify a module.
このように、componentを作成する際にエラーが出ました。
More than one module matches. Use the ‘–skip-import’
option to skip importing the component into the closest module or use the module option to specify a module.
を日本語に訳すと、
複数のモジュールが一致します。’–skip-import’を使用します。
コンポーネントを最も近いモジュールにインポートすることをスキップするオプション、またはモジュールオプションを使用してモジュールを指定するオプション。
エラー文にあるように、–skip-importオプションをつけることで、解決します。
% ng generate component phone --skip-import
※app.module.tsには自動的にimportしない。
または、
% ng generate component phone --module app.module
こちらでもエラーは解消します。
※app.module.tsにコンポーネントをimportする。
コメント