NgModule不是函数 [英] NgModule is not a function
本文介绍了NgModule不是函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
从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"
}
}
解决方案
如果我错了,请纠正我.
我相信NgModule是RC5功能.您可能必须将angular 2应用程序更新为RC5.
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://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"
}
}
解决方案
Correct me if i'm wrong.
I believe NgModule is RC5 feature. You will probably have to update your angular 2 app to RC5.
这篇关于NgModule不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文