You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ERROR in Illegal state: symbol without members expected when using AOT in 4.3.0 #18170
[x] Regression
[ ] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
Current behavior
Getting error when building for production (AOT enabled) with a certain pattern of imports/exports (see below). The error reported is:
ERROR in Illegal state: symbol without members expected, but got {"filePath":"snip/test/ng/aottest/src/app/shared/role-co
nstants.ts","name":"RoleConstants","members":["USER"]}.
ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in 'snip\test\ng\aottest\src'
@ ./src/main.ts 4:0-74
@ multi ./src/main.ts
Worked ok in 4.2.6, does not work in 4.3.0.
Expected behavior
ng build --prod should build correctly without rising the error.
Minimal reproduction of the problem with instructions
The project contain a newly generated project (with ng new) with a number of files added to reproduce the error:
shared/const.ts - exports a constant field
shared/index.ts - exports consts above
intermediate.ts - imports consts exports aggregated data
index.ts - exports intermediate above
module.ts - is calling RouterModule.forRoot([...intermediate] with intermediate imported from above.
If import { Consts } from './shared'; is changed to import { Consts } from './shared/consts'; in intermediate.ts the problem does not manifest anymore.
What is the motivation / use case for changing the behavior?
n/a
Environment
Angular version: 4.3.0
(worked ok in 4.2.6.)
For Tooling issues:
- Node version: v7.10.0
- Platform: Windows
@aleris I can't reproduce this issue. See screenshot below. What version of the CLI are you using?
Can you update the CLI to 1.3.0-beta.1 and test against it plz?
I made few tests with this sample
With Global CLI 1.2.1 and local 1.0.0
With global and local CLI 1.2.1
With local CLI 1.3.0-beta.1
With global and local CLI 1.3.0-beta.1
Could it be possible that you have a different angular version linked or something?
Concretely because of the new condition references > 0 in this if:
// Stop simplification at builtin symbols or if we are in a reference context
if (expression === self.injectionToken || expression === self.opaqueToken ||
self.conversionMap.has(expression) || references > 0) {
return expression;
}
Reacted by Deepu K Sasidharan, Wassim Chegham, Torqode, Bruno de Moura Ribeiro, Xiaoming Zhu, Peter Grman and Mithun Patel
Reacted by Deepu K Sasidharan, Scott Williams, Xiaoming Zhu, Peter Grman, Dawid Ryłko and Michal Filip
I have the same error after upgrading angular from 4.1.3 to 4.3.1 and CLI from 1.1.0 to 1.2.3. export enum ModDeschidere { CREATE = 0, VIEW = 1, EDIT = 2 }
ERROR in Illegal state: symbol without members expected, but got {"filePath":"src/app/core/modDeschidere.ts","name":"ModDeschidere","members":["CREATE"]}.
// Stop simplification at builtin symbols or if we are in a reference context
if (expression === self.injectionToken || expression === self.opaqueToken ||
self.conversionMap.has(expression) || references > 0) {
return expression;
}
And modify it to look like this:
// Stop simplification at builtin symbols or if we are in a reference context
if (expression === self.injectionToken || expression === self.opaqueToken ||
self.conversionMap.has(expression)) {
return expression;
}
@janousek unfortunately it is not possible (it is dangerous) in CI environment when you want to build "clean build". So i would rather suggest temporary downgrade to older angular as temporary solution.
Also noticed that if I aot compile the same code with Angular 5.0.0, I won't get the error.
But anyway we are not rushing on this issue as it's an internal application.
We can persuade client to go without aot.
I will rework the assert into a better error message for 4.x.x. We will not support indexing into members of an namespace but, at least, we should give a reasonable error message instead of an internal assert violation.
Activity
manekinekko commentedon Jul 17, 2017
@aleris I can't reproduce this issue. See screenshot below. What version of the CLI are you using?
Can you update the CLI to 1.3.0-beta.1 and test against it plz?
deepu105 commentedon Jul 17, 2017
We were using 1.2.1 in JHipster
deepu105 commentedon Jul 17, 2017
I made few tests with this sample




With Global CLI 1.2.1 and local 1.0.0
With global and local CLI 1.2.1
With local CLI 1.3.0-beta.1
With global and local CLI 1.3.0-beta.1
Could it be possible that you have a different angular version linked or something?
aleris commentedon Jul 17, 2017
After:
npm install @angular/cli@1.3.0-beta.1Same with 1.2.1 (@latest)
cjamaldine commentedon Jul 17, 2017
hello,
same error with 4.3.0, but it works with 4.2.3
@angular/cli: 1.1.2
tmakin commentedon Jul 18, 2017
I'm also getting this on an enum export when using Angular 4.3.0 on CLI 1.2.1:
Downgrade to 4.2.6 fixes it
janousek commentedon Jul 20, 2017
The error rises because of the commit ddb766e from @chuckjaz
Concretely because of the new condition
references > 0in this if:rimlin commentedon Jul 21, 2017
+1 this error with enums like:
cdllqos commentedon Jul 24, 2017
Same error as this, I just new a project and exec 'ng build --prod', and then the error comes :). By the way, I install npm package by cnpm

montella1507 commentedon Jul 27, 2017
@chuckjaz can you give us some advice, please?
florinr1 commentedon Jul 28, 2017
I have the same error after upgrading angular from 4.1.3 to 4.3.1 and CLI from 1.1.0 to 1.2.3.
export enum ModDeschidere { CREATE = 0, VIEW = 1, EDIT = 2 }I don't know what to do / test.
janousek commentedon Jul 28, 2017
For everyone who needs temporary fix for this error. Just manually modify this file:
Find this part of code:
And modify it to look like this:
Everything will work.
montella1507 commentedon Jul 28, 2017
@janousek unfortunately it is not possible (it is dangerous) in CI environment when you want to build "clean build". So i would rather suggest temporary downgrade to older angular as temporary solution.
58 remaining items
sunb0002 commentedon Dec 2, 2017
@chuckjaz Thank you for the prompt response.
I've created it here: https://github.com/sunb0002/angularissue
'ng build' is ok, while 'ng build --aot' gets errors.
Also noticed that if I aot compile the same code with Angular 5.0.0, I won't get the error.
But anyway we are not rushing on this issue as it's an internal application.
We can persuade client to go without aot.
chuckjaz commentedon Dec 11, 2017
@sunb0002 A work around for your case is to introduce a intermediate exported symbol:
This type of rewriting is performed automatically in 5.0 and is transformed into something like,
I will rework the assert into a better error message for 4.x.x. We will not support indexing into members of an namespace but, at least, we should give a reasonable error message instead of an internal assert violation.
sunb0002 commentedon Dec 12, 2017
@chuckjaz Thanks a lot for the help. It's working now.
fix(compiler): support referencing enums in namespaces
fix(compiler): support referencing enums in namespaces (#20947)
angular-automatic-lock-bot commentedon Sep 13, 2019
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.