@角/形式/索引"'没有导出的mng' FormsModule'

时间:2016-09-04 13:24:31

标签: angular

我对Angular 2完全陌生,我在app.module.ts文件中导入FormsModule时遇到此错误。

"dependencies": {
"@angular/common": "2.0.0-rc.5",
"@angular/compiler": "2.0.0-rc.5",
"@angular/core": "2.0.0-rc.5",
"@angular/forms": "0.2.0",
"@angular/http": "2.0.0-rc.5",
"@angular/platform-browser": "2.0.0-rc.5",
"@angular/platform-browser-dynamic": "2.0.0-rc.5",
"@angular/router": "3.0.0-beta.2",
"es6-shim": "0.35.1",
"reflect-metadata": "0.1.3",
"rxjs": "5.0.0-beta.6",
"systemjs": "0.19.26",
"zone.js": "0.6.12"

这是我对package.json的依赖:

include_blank

},

2 个答案:

答案 0 :(得分:2)

在这行package.json:

"@angular/forms": "0.2.0"

更新至:

"@angular/forms": "0.3.0"

再次跑:

npm install

问题解决了!

答案 1 :(得分:0)

将依赖关系更新为

 "dependencies": {
     "@angular/common": "2.0.0",
     "@angular/compiler": "2.0.0",
     "@angular/core": "2.0.0",
     "@angular/forms": "2.0.0",
     "@angular/http": "2.0.0",
     "@angular/platform-browser": "2.0.0",
     "@angular/platform-browser-dynamic": "2.0.0",
     "@angular/router": "3.0.0",
     "@angular/upgrade": "2.0.0",
     "core-js": "^2.4.1",
     "reflect-metadata": "^0.1.3",
     "rxjs": "5.0.0-beta.12",
     "systemjs": "0.19.27",
     "zone.js": "^0.6.23",
     "angular2-in-memory-web-api": "0.0.20",
     "bootstrap": "^3.3.6"   },

再次跑:

npm install