nxn
nxn

Reputation: 1

NgModule is not a function

As of last Friday 19 Aug 2016 I started getting a runtime javascript console error:

Error: TypeError: s.NgModule is not a function(…)

in my RC4-based application. I have not tried to update to RC5 yet so I would expect my RC4-based code to still work per the documentation. My package.json is (a bit anonymized):

    {
  "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://[email protected]/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"
  }
}

Upvotes: 0

Views: 2023

Answers (2)

penleychan
penleychan

Reputation: 5470

Correct me if i'm wrong.

I believe NgModule is RC5 feature. You will probably have to update your angular 2 app to RC5.

Upvotes: 3

Ben Richards
Ben Richards

Reputation: 3575

That means one of your packages has been upgraded and requires the RC5 version of Angular 2. Look at one of the following:

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

The ^ in front of the package number means at least that version, but if a later version is available it will be upgraded to it. The way to fix is it to remove the "^", delete your "node_modules" directory and do "npm install" again.

Upvotes: 0

Related Questions