我学习angular2。安装了node.js,npm,typescript。
我运行npm start
显示错误:
app/my-component.component.ts(1,25): error TS2307: Cannot find module 'angular2/core'.
我-component.component.ts
import {Component} from "angular2/core";
@Component({
selector: 'my-component',
template: `
This is my component!
`
})
export class MyComponentComponent {
}
的index.html
<html>
<head>
<title>Angular 2 QuickStart</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">
<!-- Polyfill(s) for older browsers -->
<script src="node_modules/core-js/client/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>
<script src="systemjs.config.js"></script>
<script>
System.import('app').catch(function(err){ console.error(err); });
</script>
</head>
<body>
<my-app>Loading...</my-app>
</body>
</html>
我无法理解为什么找不到angular2 / core? 你能帮忙吗
答案 0 :(得分:0)
使用
@angular/core
代替将解决错误 希望这会对你有所帮助。