2016-10-31 7 views
0

VS2015でAuth0をサポートするAngular2ウェブフロントエンドを構築しようとしています。私はこの記事http://blog.stevensanderson.com/2016/10/04/angular2-template-for-visual-studio/に記載されているテンプレートを使用し、https://auth0.com/docs/quickstart/spa/angular2でAngular2のAuth0ガイドに従おうとしましたが、私は何も起きないでしょう。それは私がAuth0を追加する前に働いて、私はそれが私がAuth0を追加した方法と関係があると思うが、私はそれを働かせることはできません。私は現在のエラーメッセージを以下に貼り付けますが、この共通のdotnet VS2015テンプレートにAuth0を追加するために必要な手順を実際に見つけようとしています。私はこの特定のテンプレートを使用しています。これは主に、ビジュアルスタジオで働くホットコードの変更のような主な機能をすべて備えているようです。ASP.Net Core Angular2テンプレートとAuth0が機能しない

Exception: Call to Node module failed with error: ReferenceError: Auth0Lock is not defined 
at new Auth (C:\Code\videofilenameinfo\VideoFileInfo\NameParserWebsite\ClientApp\dist\main-server.js:230:26) 
at AppView._View_AppComponent_Host0.createInternal (AppComponent_Host.ngfactory.js:15:20) 
at AppView.create (C:\Code\videofilenameinfo\VideoFileInfo\NameParserWebsite\node_modules\@angular\core\bundles\core.umd.js:9419:25) 
at ComponentFactory.create (C:\Code\videofilenameinfo\VideoFileInfo\NameParserWebsite\node_modules\@angular\core\bundles\core.umd.js:6029:40) 
at ApplicationRef_.bootstrap (C:\Code\videofilenameinfo\VideoFileInfo\NameParserWebsite\node_modules\@angular\core\bundles\core.umd.js:7051:44) 
at C:\Code\videofilenameinfo\VideoFileInfo\NameParserWebsite\node_modules\@angular\core\bundles\core.umd.js:6960:93 
at Array.forEach (native) 
at PlatformRef_._moduleDoBootstrap (C:\Code\videofilenameinfo\VideoFileInfo\NameParserWebsite\node_modules\@angular\core\bundles\core.umd.js:6960:46) 
at C:\Code\videofilenameinfo\VideoFileInfo\NameParserWebsite\node_modules\@angular\core\bundles\core.umd.js:6928:31 
at ZoneDelegate.invoke (C:\Code\videofilenameinfo\VideoFileInfo\NameParserWebsite\node_modules\zone.js\dist\zone-node.js:232:26) 
+0

「declare var Auth0Lock:any;」を変更するための提案が見つかりました。 "auth0Lock:any = require( 'auth0-lock')。デフォルト;" TypeError:C:\ Code \ videofilenameinfo \ VideoFileInfo \ NameParserWebsite \ node_modules \ auth0-lock \ lib \ ui \に未定義の のプロパティ 'createElement'を読み取ることができませんでした。 box \ header.js:138:27 atオブジェクト。モジュール番号:(C:¥Code¥videofilenameinfo¥VideoFileInfo¥NameParserWebsite¥node_modules¥auth0-lock¥lib¥ui¥box¥header.js:141:2) at Module._compile(module.js:570:32) – Seer

答えて

3

プレレンダーモジュールが問題であることが分かります。 Auth0はプリレンダーをサポートしていません。 Auth0スタッフは私にそれを指摘した。(https://auth0.com/forum/t/asp-net-core-angular2-and-auth0-not-working/4170

重要な部分は、ビュー/ホーム/ Index.cshtmlで<app>要素からASP-事前レンダリング・モジュールの属性を除去することにより、サーバー側の事前レンダリングを無効にしています。

+0

同じ問題。どうやってそれを稼働させましたか?あなたは頭の中にCDNのURLを入れなければなりませんでしたか? – minerva

+0

@minervaはいヘッドタグ内の_layout.cshtmlページにそれを入れます。 – Seer

+0

私はheadタグにcdn urlを置いていましたが、私はまだ 'Auth0Lockが定義されていません'という同じエラーが発生しています。 Auth0ロックを統合してサンプルプロジェクトを投稿できますか? – minerva

関連する問題