问题
I upgraded my Angular 2 Plunker from RC.4 to RC.5 by doing the following:
- updated systemjs.config.js to match the quickstart plunker
- updated main.ts to match the quickstart plunker
- created file app/app.module.ts, and populated it with what the quickstart plunker has
I don't see any other changes that are required for my simply plunker.
I keep getting this error: Error: TypeError: core_1.NgModule is not a function(…)
回答1:
I hit the exact same problem on my project. It worked on 1 pc, didn't work on another. Turns out the solution was simple:
Clear your browser cache
回答2:
Although I'm not sure what the problem is, this fixes it:
- save your changes
- reload the page/plunker
The error no longer appears. (I assume it has something to do with some old files that are not getting regenerated properly.)
回答3:
The tour of heroes tutorial has changed and introduced app.module.ts and also versions in systemjs.config.js for ex: ngVer is now @2.0.0-rc.5'. Replace the systemjs.config.js and everything worked fine for me.
回答4:
You can follow the angular upgrade rc4 to rc5 docs here: https://angular.io/docs/ts/latest/cookbook/rc4-to-rc5.html
来源:https://stackoverflow.com/questions/38887044/angular-2-rc-5-plunker-error-typeerror-core-1-ngmodule-is-not-a-function