Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ngCompiler.ReflectorHost is not a constructor #3668

Closed
maxime1992 opened this issue Dec 21, 2016 · 11 comments
Closed

ngCompiler.ReflectorHost is not a constructor #3668

maxime1992 opened this issue Dec 21, 2016 · 11 comments

Comments

@maxime1992
Copy link
Contributor

maxime1992 commented Dec 21, 2016

Please provide us with the following information:

OS?

Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)

Ubuntu 16.10

Versions.

Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here:

$ ng -v
angular-cli: 1.0.0-beta.24
node: 6.8.0
os: linux x64
@angular/common: 2.3.1
@angular/compiler: 2.3.1
@angular/core: 2.3.1
@angular/forms: 2.3.1
@angular/http: 2.3.1
@angular/material: 2.0.0-alpha.11-3
@angular/platform-browser: 2.3.1
@angular/platform-browser-dynamic: 2.3.1
@angular/router: 3.3.1
@angular/compiler-cli: 2.3.1

(I did also try with 2.2.4 but I get This version of CLI is only compatible with angular version 2.3.1 or better and with 2.4.0 but it's not working either).

Repro steps.

Was this an app that wasn't created using the CLI? What change did you do on your code? etc.

Upgrade an app to beta-24
ng serve

The log given by the failure.

Normally this include a stack trace and some more information.

ngCompiler.ReflectorHost is not a constructor
TypeError: ngCompiler.ReflectorHost is not a constructor
    at AotPlugin._setupOptions (/home/maxime/Documents/petals-cockpit/frontend/node_modules/@ngtools/webpack/src/plugin.js:127:31)
    at new AotPlugin (/home/maxime/Documents/petals-cockpit/frontend/node_modules/@ngtools/webpack/src/plugin.js:35:14)
    at Object.exports.getWebpackNonAotConfigPartial (/home/maxime/Documents/petals-cockpit/frontend/node_modules/angular-cli/models/webpack-build-typescript.js:20:13)
    at new NgCliWebpackConfig (/home/maxime/Documents/petals-cockpit/frontend/node_modules/angular-cli/models/webpack-config.js:26:42)
    at Class.run (/home/maxime/Documents/petals-cockpit/frontend/node_modules/angular-cli/tasks/serve-webpack.js:20:22)
    at /home/maxime/Documents/petals-cockpit/frontend/node_modules/angular-cli/commands/serve.js:108:26
    at process._tickCallback (internal/process/next_tick.js:103:7)

Mention any other details that might be useful.

As #3607, #3587 are now closed, I decided to open a new issue because it was supposed to be fixed in beta-24.

(at least, I presume you were talking about beta-24 @hansl)
image

@intellix
Copy link
Contributor

intellix commented Dec 21, 2016

Same. Perhaps it would be good to report the version of TypeScript as well. I've a feeling I'm going to get asked what it is

bash-4.4$ ng version
angular-cli: 1.0.0-beta.24
node: 7.1.0
os: darwin x64
@angular/common: 2.4.0
@angular/compiler: 2.4.0
@angular/core: 2.4.0
@angular/forms: 2.4.0
@angular/http: 2.4.0
@angular/platform-browser: 2.4.0
@angular/platform-browser-dynamic: 2.4.0
@angular/router: 3.4.0
@angular/compiler-cli: 2.4.0

bash-4.4$ ng serve
ngCompiler.ReflectorHost is not a constructor
TypeError: ngCompiler.ReflectorHost is not a constructor
    at AotPlugin._setupOptions (/Users/dominic/Sites/stash/xcaf/r2d2/node_modules/@ngtools/webpack/src/plugin.js:136:31)
    at new AotPlugin (/Users/dominic/Sites/stash/xcaf/r2d2/node_modules/@ngtools/webpack/src/plugin.js:37:14)
    at Object.exports.getWebpackNonAotConfigPartial (/Users/dominic/Sites/stash/xcaf/r2d2/node_modules/angular-cli/models/webpack-build-typescript.js:20:13)
    at new NgCliWebpackConfig (/Users/dominic/Sites/stash/xcaf/r2d2/node_modules/angular-cli/models/webpack-config.js:26:42)
    at Class.run (/Users/dominic/Sites/stash/xcaf/r2d2/node_modules/angular-cli/tasks/serve-webpack.js:20:22)
    at /Users/dominic/Sites/stash/xcaf/r2d2/node_modules/angular-cli/commands/serve.js:108:26
    at process._tickCallback (internal/process/next_tick.js:103:7)

@intellix
Copy link
Contributor

intellix commented Dec 21, 2016

ok, so I was told to try following the upgrade options specified in README.md... afterwards it now works.

bash-4.4$ ng version
angular-cli: 1.0.0-beta.24
node: 7.1.0
os: darwin x64
@angular/common: 2.4.0
@angular/compiler: 2.4.0
@angular/core: 2.4.0
@angular/forms: 2.4.0
@angular/http: 2.4.0
@angular/platform-browser: 2.4.0
@angular/platform-browser-dynamic: 2.4.0
@angular/router: 3.4.0
@angular/compiler-cli: 2.4.0

bash-4.4$ ng serve
** NG Live Development Server is running on http://localhost:4200. **
Hash: 9fbb594e5458db2f5d7c
Time: 25475ms
chunk    {0} main.bundle.js, main.bundle.map (main) 185 kB {2} [initial] [rendered]
chunk    {1} styles.bundle.css, styles.bundle.map, styles.bundle.map (styles) 182 kB {3} [initial] [rendered]
chunk    {2} vendor.bundle.js, vendor.bundle.map (vendor) 3.16 MB [initial] [rendered]
chunk    {3} inline.bundle.js, inline.bundle.map (inline) 0 bytes [entry] [rendered]
bash-4.4$ npm list typescript
[email protected] /Users/dominic/Sites/stash/xcaf/r2d2
├── UNMET PEER DEPENDENCY @angular/[email protected]
├── UNMET PEER DEPENDENCY @angular/[email protected]
├── UNMET PEER DEPENDENCY [email protected]
└── [email protected]

npm ERR! peer dep missing: @angular/compiler@<=2.3 >=2.2.0, required by [email protected]
npm ERR! peer dep missing: @angular/core@<=2.3 >=2.2.0, required by [email protected]
npm ERR! peer dep missing: tslint@~4.0.0, required by [email protected]

How can everything work now with the exact same versions as above?

I'm starting to think that angular-cli should ship with a yarn.lock to ensure dependencies are exactly the same regardless of cache on every machine

@maxime1992
Copy link
Contributor Author

You're totally right for Typescript. I'm using Typescript 2.1.4.

Having a yarn.lock would be good but in case of conflicts with users when upgrading, might be more complicated, what do you think ?

@alexciesielski
Copy link

alexciesielski commented Dec 21, 2016

Same issue with beta.24

angular-cli: 1.0.0-beta.24
node: 6.9.2
os: linux x64
@angular/common: 2.4.0
@angular/compiler: 2.4.0
@angular/core: 2.4.0
@angular/forms: 2.4.0
@angular/http: 2.4.0
@angular/platform-browser: 2.4.0
@angular/platform-browser-dynamic: 2.4.0
@angular/router: 3.1.1
@angular/compiler-cli: 2.4.0
@angular/language-service: 2.3.0

"typescript": "~2.1.4",

$ ng serve

ngCompiler.ReflectorHost is not a constructor
TypeError: ngCompiler.ReflectorHost is not a constructor
at AotPlugin._setupOptions (/home/ciesielskico/Documents/app/node_modules/@ngtools/webpack/src/plugin.js:136:31)
at new AotPlugin (/home/ciesielskico/Documents/app/node_modules/@ngtools/webpack/src/plugin.js:37:14)
at Object.exports.getWebpackNonAotConfigPartial (/home/ciesielskico/Documents/app/node_modules/angular-cli/models/webpack-build
-typescript.js:20:13)
at new NgCliWebpackConfig (/home/ciesielskico/Documents/app/node_modules/angular-cli/models/webpack-config.js:26:42)
at Class.run (/home/ciesielskico/Documents/app/node_modules/angular-cli/tasks/serve-webpack.js:20:22)
at /home/ciesielskico/Documents/app/node_modules/angular-cli/commands/serve.js:108:26
at process._tickCallback (internal/process/next_tick.js:103:7)

NOTE
I am using an older version of @angular/router because of the 'Routers instantiated twice' bug, but I've also tried running ng serve with the latest version and that is not the issue.


Update:

Setting local version of cli back to beta.22-1 (global still 24) resolves the above error and products another one/hangs on the following lines at 21%:

** NG Live Development Server is running on http://localhost:4200. **
10% building modules 3/3 modules 0 activecan't resolve module ./directives from /home/ciesielskico/Documents/webapp/node_modules/@ang
ular/forms/src/form_providers.d.ts
(node:28997) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Cannot read property 'TEMPLATE_DRIVEN_DIRECTIVES' of undefined, resolv
ing symbol FormsModule in /home/ciesielskico/Documents/webapp/node_modules/@angular/forms/src/form_providers.d.ts, resolving symbol Fo
rmsModule in /home/ciesielskico/Documents/webapp/node_modules/@angular/forms/src/form_providers.d.ts
21% building modules 92/92 modules 0 active

@dojchek
Copy link

dojchek commented Dec 21, 2016

It stops on 21% for me as well. I have the exact same setting as you.
This is because the beta.22-1 is not compatible with angular 2.3.0+

So, for now I'm downgrading back to angular 2.2.3 (router 3.2.3) and angular-cli beta.22-1

@maxime1992
Copy link
Contributor Author

@dojchek we're talking about beta-24 here and look what I wrote in the topic :

I did also try with 2.2.4 but I get "This version of CLI is only compatible with angular version 2.3.1 or better and with 2.4.0" but it's not working either

So with beta-24, we just can't downgrade to 2.2.3

@dojchek
Copy link

dojchek commented Dec 21, 2016

@maxime1992
Yes, I know - Just wanted to share my troubles, since I ran into the same issue. Ended up spending half a day trying to get it work and eventually downgraded until this gets fixed..

@wesleycho
Copy link
Contributor

This is basically an issue with Angular 2.3+ and @ngtools/webpack I believe. This is fixed in the latest releases I believe.

@alexbyk
Copy link

alexbyk commented Dec 23, 2016

+1

@filipesilva
Copy link
Contributor

Seems to be fixed in latest now.

See #3426 (comment) regarding TS2.1 compatibility.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants