0
私は以前働いていたアプリで作業しています。私は今、いくつかのルーティングを追加しようとしていますので、app.componentファイルを作成し、いくつかのパラメータを変更したが、今私は空白の画面やコンソールでこのエラーが出る...角2 "は定義されていません"
Error: ReferenceError: require is not defined
at eval (http://localhost:3000/client/dev/main.js:2:17)
at eval (http://localhost:3000/client/dev/main.js:6:3)
at $ (http://localhost:3000/node_modules/systemjs/dist/system-polyfills.js:4:8740)
Evaluating http://localhost:3000/client/dev/main.js
Error loading http://localhost:3000/client/dev/main.js
"use strict";
var browser_1 = require('angular2/platform/browser');
var app_component_1 = require('./app.component');
browser_1.bootstrap(app_component_1.AppComponent);
これはmain.ts
から生成されます。
import { bootstrap } from 'angular2/platform/browser';
import { AppComponent } from './app.component';
bootstrap(AppComponent);
これで間違っていただきましたか?
更新:
おかげエリックtsconfig.jsonにシステムモジュールを使用する方法についてご提案を、私はそれを行うならば、私は次のエラーを取得:
C:\Users\George\Source\Repos\Gen-App\server\server.js:2
System.register(['express', 'os', 'http', './config/routes.conf', './config/db.conf', './config/passport', './routes/index'], function(exports_1, context_1) {
^
ReferenceError: System is not defined
at Object.<anonymous> (C:\Users\George\Source\Repos\Gen-App\server\server.js:2:1)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (C:\Users\George\Source\Repos\Gen-App\index.js:1:63)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
NB:私のserver.jsをコードはhere
をごtsconfig.jsonファイルをチェックし、「モジュール」プロパティを参照してください、それは「commonjs」であれば、「システム」に変更し、ファイルを再コンパイルします。 –
私もこのことに不満を抱いていました。 @Ericの言うことに加えて、私はモジュール 'システム'を使うためにtscを最新のものにアップグレードしなければならなかった。 –
@ EricMartinezありがとうございました。これはうまくいきましたが、これは以前は動作していたサーバ側のコードが壊れてしまいました。このエラーは 'ReferenceError:システムが定義されていません。 'というメッセージに詳細が追加されます –