angular-cli: Error: ngCompiler.ReflectorHost is not a constructor
Please provide us with the following information:
OS?
Mac OSX (Sierra)
Versions.
ngtools/webpack - 1.1.7
Repro steps.
git clone github.com/prsolucoes/angular2-starter-project cd angular2-starter-project npm install npm start
The log given by the failure.
paulo@MacBook-Pro-de-Paulo:~/Developer/workspaces/node/angular2-starter-project (master) $ npm start
> angular2-starter-project@1.0.0 start /Users/paulo/Developer/workspaces/node/angular2-starter-project
> npm run ngc && concurrently -r "webpack-dev-server --config webpack.config.js" "node ./bin/ngc-watch.js"
> angular2-starter-project@1.0.0 ngc /Users/paulo/Developer/workspaces/node/angular2-starter-project
> ngc -p ./tsconfig.json
/Users/paulo/Developer/workspaces/node/angular2-starter-project/node_modules/@ngtools/webpack/src/plugin.js:127
this._reflectorHost = new ngCompiler.ReflectorHost(this._program, this._compilerHost, this._angularCompilerOptions);
^
TypeError: ngCompiler.ReflectorHost is not a constructor
at AotPlugin._setupOptions (/Users/paulo/Developer/workspaces/node/angular2-starter-project/node_modules/@ngtools/webpack/src/plugin.js:127:31)
at new AotPlugin (/Users/paulo/Developer/workspaces/node/angular2-starter-project/node_modules/@ngtools/webpack/src/plugin.js:35:14)
at Object.<anonymous> (/Users/paulo/Developer/workspaces/node/angular2-starter-project/webpack/plugins.js:12:2)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/paulo/Developer/workspaces/node/angular2-starter-project/webpack.config.js:15:11)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
Mention any other details that might be useful.
My repository with the current problem: https://github.com/prsolucoes/angular2-starter-project
My plugin initialization:
let ngtools = require('@ngtools/webpack');
module.exports = [
new ngtools.AotPlugin({
tsConfigPath: './tsconfig.json',
baseDir: path.join(process.cwd(), 'src'),
entryModule: path.join(process.cwd(), 'src', 'app', 'modules', 'app.module') + '#AppModule'
}),
....
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 10
- Comments: 47 (5 by maintainers)
Commits related to this issue
- refactor(compiler): move `findDeclaration` into the `StaticReflector` Previously, this was part of the `AotCompilerHost`. The `AotCompilerHost` is now also greatly simplified. — committed to angular/angular by tbosch 8 years ago
- update angular-cli to fix AOT compilation - see https://github.com/angular/angular-cli/issues/3241 and https://github.com/angular/angular-cli/pull/3242 — committed to MartinNowak/alertd by MartinNowak 8 years ago
- Lock angular versions for AOT. Workaround for this known issue: https://github.com/angular/angular-cli/issues/3241 — committed to debben/ng2-admin by debben 8 years ago
- update angular-cli to fix AOT compilation - see https://github.com/angular/angular-cli/issues/3241 and https://github.com/angular/angular-cli/pull/3242 — committed to MartinNowak/alertd by MartinNowak 8 years ago
I’m also seeing this issue with
angular-cli 1.0.0-beta.22-1
+angular 2.3.0
.Also same problem.
Angular: 2.3.0 CLI: 1.0.0-beta.22-1
Same here with angular 2.3.0. Please re-open.
Same with my project too!
Angular: 2.3.0 CLI: 1.0.0-beta.22-1
I had the same issue; all that was required to fix it was to remove
node_modules
and runnpm install
.If you’re using yarn you need to remove both
node_modules
andyarn.lock
and runyarn
afterwards. I suspect a dependency of a dependency is fixed in a newer version and you just need to update it.Still does not work. This is ridiculous.
I was able to get the angular 2.3.0 working downgrading the angular-cli from version angular-cli@1.0.0-beta.22-1 to version angular-cli@1.0.0-beta.21. Now the error has gone.
I think this is due to the angular 2.2.2 moving ReflectorHost to
@angular/language-service
.As a temporary workaround, I’ve locked my versions to 2.2.1 for
@angular/*
, 3.2.1 for@angular/router
, 2.0.10 fortypescript
and everything seems to be building fine with AoT.had the same problem with beta 24, try creating a new project , then copy your source folder to that new project. then modify config files as required. It worked for me.
Tried all suggested solutions still nothing working. @angular2.3 @ngtools/webpack 1.1.9
This is unreal. I can’t build my project about 2 weeks. Every combination of versions gives different errors.
Has progress?i has same issuse,i used webpack(2.1.0-beta.25) @angular(2.2.3) @ngtools/webpack(1.1.9)
Same issue here with 1.0.0-beta.23, as in (#3501, #3467 and #3367). Besides the problem building, I do not know why UNMET PEER DEPENDENCY message when installing latest CLI release.
@Adrriver it worked well for me
I installed angular-cli@1.0.0-beta.21 locally.
@reginaldocmrg WOW that worked!
For those subscribed to this issue, there’s a bit more detail on another issue: https://github.com/angular/angular-cli/issues/3467#issuecomment-265814703
I’m not sure why HanZ closed this. Everything was working perfect for me with angular-cli-b21, this morning i update angular-cli-b22, tried to build, and i was looking at the error in my console. Same error mentioned above. I’m certain this has something to do with minor project configuration impedance, and you might like to call it a bug, no bug has ever stopped me before, so why would this one stop me now? And, no, I’m not rolling back any of dependencies, i keep everything on the bleeding edge.