0

截至 2016 年 8 月 19 日上周五,我开始收到运行时 javascript 控制台错误:

错误:TypeError:s.NgModule 不是函数(…)

在我的基于 RC4 的应用程序中。我还没有尝试更新到 RC5,所以我希望我的基于 RC4 的代码仍然可以按照文档工作。我的 package.json 是(有点匿名):

    {
  "name": "xxxxxxxxxx",
  "version": "2.0.0",
  "description": "xxxxxxxxxxxxxxxxxyyyyyyyyy",
  "scripts": {
    "start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
    "lite": "node server.js --lifecycle=lcl",
    "postinstall": "typings install",
    "tsc": "tsc",
    "tsc:w": "tsc -w",
    "typings": "typings"
  },
  "author": "xxxxxxxxxxxxxxxxx",
  "dependencies": {
    "@angular/common": "2.0.0-rc.4",
    "@angular/compiler": "2.0.0-rc.4",
    "@angular/core": "2.0.0-rc.4",
    "@angular/http": "2.0.0-rc.4",
    "@angular/platform-browser": "2.0.0-rc.4",
    "@angular/platform-browser-dynamic": "2.0.0-rc.4",
    "@angular/router": "3.0.0-beta.2",
    "@angular/upgrade": "2.0.0-rc.4",
    "@angular/forms": "0.2.0",
    "xyzco-bootstrap-custom": "git+ssh://git@gitscm.xyzco.com/asf/xyzco-bootstrap-custom.git",
    "core-js": "2.4.1",
    "jquery": "^3.1.0",
    "ng2-bootstrap": "^1.0.24",
    "ng2-redux": "^3.3.0",
    "ng2-translate": "^2.1.0",
    "redux": "^3.5.2",
    "redux-thunk": "^2.1.0",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.0.0-beta.6",
    "systemjs": "0.19.27",
    "zone.js": "^0.6.12"
  },
  "devDependencies": {
    "body-parser": "^1.15.2",
    "concurrently": "^2.0.0",
    "del": "^2.2.1",
    "express": "^4.14.0",
    "gulp": "^3.9.1",
    "gulp-clean-css": "^2.0.11",
    "gulp-concat": "^2.6.0",
    "gulp-inline-ng2-template": "^2.1.0",
    "gulp-jspm-build": "0.0.15",
    "gulp-rename": "^1.2.2",
    "gulp-sass": "^2.3.2",
    "gulp-sequence": "^0.4.5",
    "gulp-traceur": "^0.17.2",
    "gulp-typescript": "^2.13.6",
    "gulp-uglify": "^1.5.4",
    "helmet": "^2.1.1",
    "lite-server": "^2.2.0",
    "mongojs": "^2.4.0",
    "sql-injection": "0.0.5",
    "systemjs-builder": "^0.15.23",
    "typescript": "^1.8.10",
    "typings": "^1.3.2"
  }
}
4

2 回答 2

3

如我错了请纠正我。

我相信 NgModule 是 RC5 功能。您可能必须将 Angular 2 应用程序更新为 RC5。

于 2016-08-22T23:04:53.953 回答
0

这意味着您的某个软件包已升级,并且需要 Angular 2 的 RC5 版本。请查看以下内容之一:

"ng2-bootstrap": "^1.0.24",
"ng2-redux": "^3.3.0",
"ng2-translate": "^2.1.0",
"redux": "^3.5.2",
"redux-thunk": "^2.1.0",

包号前面的 ^ 至少表示该版本,但如果有更高版本可用,它将升级到该版本。修复的方法是删除“^”,删除“node_modules”目录并再次执行“npm install”。

于 2016-08-22T23:02:08.497 回答