我已经按照起始指南,并扩展了一个以前的angular 2版本。我更新了我的修订版本,并相应地改变了一切。
当我运行Web服务器时,我现在收到错误404 traceur …
当我运行Web服务器时,我现在收到错误404 traceur …
相关文件:
Index.html:
<html> <head> <title>Kinepolis HR-tool</title> <base href="./"> <Meta charset="utf-8"> <Meta http-equiv="X-UA-Compatible" content="IE=edge"> <Meta name="viewport" content="width=device-width,initial-scale=1"> <Meta name="description" content="Kinepolis HR tool"> <Meta name="author" content="Jeffrey Devloo!"> <link rel="stylesheet" type="text/css" href="assets/css/bootstrap.min.css" /> <!-- CSS for PrimeUI --> <!-- 1. Load libraries --> <!-- Polyfill(s) for older browsers --> <script src="node_modules/es6-shim/es6-shim.min.js"></script> <script src="node_modules/zone.js/dist/zone.js"></script> <script src="node_modules/reflect-Metadata/Reflect.js"></script> <script src="node_modules/systemjs/dist/system.src.js"></script> <!-- 2. Configure SystemJS --> <script src="systemjs.config.js"></script> <script> System.import('app').catch(function(err){ console.error(err); }); </script> </head> <!-- 3. Display the application --> <body> <my-app>Loading...</my-app> </body> </html>
systemjs.config.js
(function(global) { // map tells the System loader where to look for things var map = { 'app': 'app',// 'dist','rxjs': 'node_modules/rxjs','angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api','@angular': 'node_modules/@angular',}; // packages tells the System loader how to load when no filename and/or no extension var packages = { 'app': { main: 'main.js',defaultExtension: 'js' },'rxjs': { defaultExtension: 'js' },'angular2-in-memory-web-api': { defaultExtension: 'js' },}; var packageNames = [ '@angular/common','@angular/compiler','@angular/core','@angular/http','@angular/platform-browser','@angular/platform-browser-dynamic','@angular/router','@angular/router-deprecated','@angular/testing','@angular/upgrade',]; // add package entries for angular packages in the form '@angular/common': { main: 'index.js',defaultExtension: 'js' } packageNames.forEach(function(pkgName) { packages[pkgName] = { main: 'index.js',defaultExtension: 'js' }; }); var config = { map: map,packages: packages } // filterSystemConfig - index.html's chance to modify config before we register it. if (global.filterSystemConfig) { global.filterSystemConfig(config); } System.config(config); })(this);
tsconfig.json
{ "compilerOptions": { "target": "es5","module": "commonjs","moduleResolution": "node","sourceMap": true,"emitDecoratorMetadata": true,"experimentalDecorators": true,"removeComments": false,"noImplicitAny": false },"exclude": [ "node_modules","typings/main","typings/main.d.ts" ] }
我在下面的Angular Heroes教程时遇到了这个问题。它是由systemjs.config.js文件中的angular-in-memory-web-api导入的无效位置引起的。正确的位置应该是:
原文链接:https://www.f2er.com/angularjs/145854.html'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js'
并删除packages.angular-in-memory-web-api
见https://github.com/angular/quickstart/commit/541bdc5f634e1142860c56cace247234edfaf74b