我正在嘗試編寫一個簡單的Angular2(使用Alpha 47)應用程序,我試圖從jspm安裝「npm guid」。它安裝得很好,但是當我嘗試運行應用程序時,我總是得到「GET http://localhost:3001/jspm_packages/npm/[email protected] 404(Not Found)」。我也嘗試加載其他軟件包,他們也想出了404.否則我的angular2應用程序工作正常。我不知道我做錯了什麼。任何幫助將非常感激!謝謝!Angular2 System.js無法找到jspm包
System.js配置文件
System.config({
baseURL: "/",
transpiler: "none",
paths: {
"npm:*": "jspm_packages/npm/*",
"github:*": "jspm_packages/github/*"
},
packages: {
"app": {
"defaultExtension": "js"
}
},
map: {
"guid": "npm:[email protected]"
}
});
的index.html
<html>
<head>
<title>Office Contacts</title>
<link rel="stylesheet" href="app/styles/foundation.css">
<script src="jspm_packages/system.src.js"></script>
<script src="node_modules/angular2/bundles/angular2.dev.js"></script>
<script src="node_modules/angular2/bundles/router.dev.js"></script>
<script src="node_modules/angular2/bundles/http.dev.js"></script>
<script src="config.js"></script>
<base href="/">
<script>
System.import('app/release/bootstrap');
</script>
<script src="node_modules/es6-shim/es6-shim.js"></script>
</head>
<body>
<app>Loading...</app>
</body>
</html>
我bootstrap.ts文件
//
// ANGULAR PROVIDERS
//
import {bootstrap, provide, FORM_PROVIDERS} from 'angular2/angular2';
import {ROUTER_PROVIDERS, HashLocationStrategy, LocationStrategy} from 'angular2/router';
import {HTTP_PROVIDERS} from 'angular2/http';
import {ContactsService} from './contacts.service';
import {guid} from 'guid';
//
// APP COMPONENT
// Top level component that holds all of our components
//
import {App} from './app';
//
// BOOTSTRAP
// Bootstrap our app with the top level component and
// inject services and providers
//
bootstrap(App, [
FORM_PROVIDERS,
ROUTER_PROVIDERS,
HTTP_PROVIDERS,
ContactsService,
guid,
provide(LocationStrategy, {useClass: HashLocationStrategy})
]);
我會給它一個鏡頭,並回來與你:-)謝謝! – cpeele00