我第一次使用带有typeScript的Angular2。我的Angular2程序没有运行,在使用 npm start运行时显示以下错误。
> angular2-quickstart@1.0.0 start D:\Users\Abhay\Angular2_Demo\angularRouting
> concurrent "npm run lite"
[0]
[0] > angular2-quickstart@1.0.0 lite D:\Users\Abhay\Angular2_Demo\angularRouting
[0] > lite-server
[0]
[0] ** browser-sync config **
[0] { injectChanges: false,
[0] files: [ './**/*.{html,htm,css,js}' ],
[0] watchOptions: { ignored: 'node_modules' },
[0] server: { baseDir: './', middleware: [ [Function], [Function] ] } }
[0] [BS] Access URLs:
[0] -------------------------------------
[0] Local: http://localhost:3000
[0] External: http://202.54.6.180:3000
[0] -------------------------------------
[0] UI: http://localhost:3001
[0] UI External: http://202.54.6.180:3001
[0] -------------------------------------
[0] [BS] Serving files from: ./
[0] [BS] Watching files...
[0] 16.08.26 15:57:46 304 GET /index.html
[0] 16.08.26 15:57:46 304 GET /node_modules/es6-shim/es6-shim.min.js
[0] 16.08.26 15:57:46 304 GET /node_modules/systemjs/dist/system-polyfills.js
[0] 16.08.26 15:57:46 304 GET /node_modules/angular2/bundles/angular2-polyfills.js
[0] 16.08.26 15:57:46 304 GET /node_modules/systemjs/dist/system.src.js
[0] 16.08.26 15:57:46 304 GET /node_modules/rxjs/bundles/Rx.js
[0] 16.08.26 15:57:46 304 GET /node_modules/angular2/bundles/angular2.dev.js
[0] 16.08.26 15:57:46 404 GET /node_module/angular2/bundles/router.dev.js>
[0] 16.08.26 15:57:46 304 GET /app/boot.js
[0] 16.08.26 15:57:46 404 GET /node_module/angular2/bundles/router.dev.js>
[0] 16.08.26 15:57:46 404 GET /angular2/router
[0] 16.08.26 15:57:46 304 GET /app/app.component.js
[0] 16.08.26 15:57:46 404 GET /angular2/router
[0] 16.08.26 15:57:46 304 GET /app/courses.component.js
[0] 16.08.26 15:57:46 304 GET /app/course.service.js

这是我的**
<html>
<head>
<title>Angular 2 QuickStart</title>
<!-- 1. Load libraries -->
<!-- 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/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>
<!-- 2. Configure SystemJS -->
<script>
System.config({
packages: {
app: {
format: 'register',
defaultExtension: 'js'
}
}
});
System.import('app/boot')
.then(null, console.error.bind(console));
</script>
<script src="node_module/angular2/bundles/router.dev.js>"></script>
</head>
<!-- 3. Display the application -->
<body>
<my-app>Loading...</my-app>
</body>
</html>
&#13;
**
如果需要任何其他文件,请了解我,请给我一些解决方案。
答案 0 :(得分:0)
你正在使用的角度版本已经过时了。您需要将angular-cli升级到最新版本,然后再试一次。从文档中,这是如何升级angular-cli:
npm uninstall -g angular-cli
npm cache clean
npm install -g angular-cli@latest
这应该将angular-cli更新为最新版本,并确保您使用的是最新版本的框架。