當我玩Angular 2時,系統JS有一個奇怪的問題。系統JS不加載模塊
一切工作正常,但似乎隨機系統JS無法找到模塊了.. 。
我收到此錯誤信息:
GET http://localhost:9000/angular2/platform/browser.js 404 (Not Found) @ system.src.js:4891(anonymous function) @ system.src.js:4891
GET http://localhost:9000/angular2/core.js 404 (Not Found) @ system.src.js:4891
GET http://localhost:9000/angular2/router.js 404 (Not Found) @ system.src.js:4891
GET http://localhost:9000/angular2/http.js 404 (Not Found) @ system.src.js:4891
GET http://localhost:9000/angular2/core.js 404 (Not Found) @ system.src.js:4891
GET http://localhost:9000/angular2/http.js 404 (Not Found) @ system.src.js:4891
GET http://localhost:9000/angular2/src/facade/lang.js 404 (Not Found) @ system.src.js:4891
GET http://localhost:9000/angular2/router.js 404 (Not Found) @ system.src.js:4891
有時它更有時是錯誤更少......
最奇怪的是,等待了一會兒,tryi後ng一遍又一遍刷新頁面,該應用程序神奇地再次開始工作!
我使用[email protected]和[email protected](最新在當時)。
腳本中的index.html與SystemJS配置部分是這樣的:
<script src="./node_modules/angular2/bundles/angular2-polyfills.js"></script>
<script src="./node_modules/es6-shim/es6-shim.min.js"></script>
<script src="./node_modules/systemjs/dist/system.js"></script>
<script>
//configure system loader
System.config({
defaultJSExtensions: true
});
//bootstrap the Angular2 application
System.import('dist/app').catch(console.log.bind(console));
</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/http.dev.js"></script>
<script src="./node_modules/angular2/bundles/router.dev.js"></script>
任何人都認識這個問題?
謝謝!
這將是很好,如果你可以分享你的systemjs配置 –
同意@Vldao。沒有這個,我們只能嘗試猜測;-) –
我已經添加了配置。 – mottosson