0

angular2サーバーを使用してクライアント側のアプリを作成していnode.jsます。クライアント側のアプリは完全に正常に動作しているようです。つまり、次のことを意味します。

  • 私の要求はすべて適切な応答を受け取ります。
  • アプリケーションがロードされ、期待どおりに動作します。

しかし、ターミナルで次のエラーが発生します。

Error: The selector "app" did not match any elements
    at DomRenderer.selectRootElement (/home/mu-user/Projects/my-app/dist/server/index.js:27126:23)
    at selectOrCreateRenderHostElement (/home/mu-user/Projects/my-app/dist/server/index.js:15687:32)
    at AppView._View_AppComponent_Host0.createInternal (/AppModule/AppComponent/host.ngfactory.js:12:16)
    at AppView.create (/home/mu-user/Projects/my-app/dist/server/index.js:50916:21)
    at ComponentFactory.create (/home/mu-user/Projects/my-app/dist/server/index.js:36656:36)
    at ApplicationRef_.bootstrap (/home/mu-user/Projects/my-app/dist/server/index.js:23313:40)
    at /home/mu-user/Projects/my-app/dist/server/index.js:23222:89
    at Array.forEach (native)
    at Object.Call (/home/mu-user/Projects/my-app/node_modules/es6-shim/es6-shim.js:307:14)
    at Array.forEach (/home/mu-user/Projects/my-app/node_modules/es6-shim/es6-shim.js:1313:17)

中断しないwebpackまたはhttp-server
問題は、なぜ私がこれに直面し、どのように解決するのかということです。

4

1 に答える 1

0

コメントでも説明したように、この回答を記録に追加しています。このバグは、 の宣言リストに含まれるモジュールへの参照を修正することで解決されましたngModule
エラー メッセージのコンテキストから問題を特定するのは困難でした。また、コードが複雑なため、実際のプロジェクト コードを含めることはできませんでしたが、ここで表示する簡単なバージョンを作成しようとしているときに問題を解決しました。

于 2017-01-13T12:53:55.093 に答える