angularjs2启动项目报ERROR in AppModule is not an NgModule解决方法

来源:互联网 发布:淘宝店铺店标素材 编辑:程序博客网 时间:2024/05/19 14:51

如图:


这主要是ts编译器版本问题,一般是因为ts编译器版本过高导致。


解决方式:

  1. npm uninstall -g typescript
  2. npm install -g typescript@2.2.2
  3. tsc -v 查看安装的typescript版本
  4. 修改package.json中的typescript版本为2.2.2 (注明:不要写为 " ^ 2.2.2")
  5. 删除node_module
  6. 重新安装cnpm install
  7. npm ls typescript 如果都为typecript版本2.2.2说明正确
  8. ng serve运行

阅读全文
0 0