【市場価値がわかる】エンジニア転職におすすめなサイト

ng generate component実行時にMore than one module matches. とエラーが出る

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する。

>>転職するのにおすすめのサイトはこちらをクリック
>>副業で稼ぐためにおすすめのサイトはこちらをクリック

スキルを売り買いするならココナラ

オンライン動画学習ならUdemy

コメント

コメントする

CAPTCHA


Contents
閉じる