私は、次のようなエラーがあります。ここではAngular2 Rxjs 404エラー
Failed to load resource: the server responded with a status of 404 (Not Found)
angular2-polyfills.js:332 Error: Error: XHR error (404 Not Found) loading http://localhost:55707/rxjs(…)
は私のindex.htmlです:
<!DOCTYPE html>
<html>
<head>
<base href="/">
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Streak Maker</title>
<link rel="icon" type="image/png" href="/images/favicon.png" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
<!-- IE required polyfills, in this exact order -->
<script src="node_modules/es6-shim/es6-shim.min.js"></script>
<script src="node_modules/systemjs/dist/system-polyfills.js"></script>
<script src="node_modules/angular2/es6/dev/src/testing/shims_for_IE.js"></script>
<script src="node_modules/angular2/bundles/angular2-polyfills.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="node_modules/rxjs/bundles/Rx.js"></script>
<script src="node_modules/angular2/bundles/angular2.dev.js"></script>
<script src="node_modules/angular2/bundles/router.js"></script>
<script src="node_modules/angular2/bundles/http.dev.js"></script>
<script src="https://code.jquery.com/jquery-2.2.0.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script>
System.config({
packages: {
app: {
format: 'register',
defaultExtension: 'js'
},
},
});
System.import('app/boot')
.then(null, console.error.bind(console));
</script>
</head>
<body>
<app>Loading...</app>
</body>
</html>
boot.ts:
///<reference path="../node_modules/angular2/typings/browser.d.ts"/>
import {App} from './app.component';
import {bootstrap} from 'angular2/platform/browser';
import {ROUTER_PROVIDERS} from 'angular2/router';
import {HTTP_PROVIDERS} from 'angular2/http';
import {APP_PROVIDERS} from './app.module';
bootstrap(App, [
//ROUTER_PROVIDERS,
//HTTP_PROVIDERS,
APP_PROVIDERS]);
私はrxjsのパスをsystem.config(それは動作しません)に入れてみましたが、rxjsバンドルを使用しているので、これを行う必要はありません。
から
あなたは、おかげで絶対的に正しいです!問題をどのように追跡したかを教えてください。 –
あなたは大歓迎です!実際、SystemJSが登録されたモジュールを見つけることができないとき(Rxjsファイルを含んでいるのでRxjsの場合)、http:///のURLからモジュールをロードしようとします。だから、あなたは 'rxjs'モジュールをロードしようとしましたが、このモジュールはRxjsによって提供されていないと思います。むしろ 'rxjs/Rx'です。だから私はあなたのコードでこのようなインポートを探しました: 'import 'rxjs';' ... –
SystemJSマップでディレクトリを指定したら、具体的には '/'をインポートして任意のファイルを参照できますか? defaultExtensionが正しく設定されていると仮定します。 –