Angular CLI: 6.0.8
Node: 8.11.1
OS: win32 x64
Angular: 6.0.6
ng build --prod
or
ng build --aot
The problem is cause by AOT. when running prod without aot it will compile successfully.
ERROR in : Error: Internal error: unknown identifier []
at Object.importExpr$$1 [as importExpr] (C:\Users\Desktop\dev\Tapp\tapp-client\tapp\node_modules\@angular\compiler\bundles\compiler.umd.js:20493:23)
at C:\Users\Desktop\dev\Tapp\tapp-client\tapp\node_modules\@angular\compiler\bundles\compiler.umd.js:9540:33
at Array.map (
at InjectableCompiler.depsArray (C:\Users\Desktop\dev\Tapp\tapp-client\tapp\node_modules\@angular\compiler\bundles\compiler.umd.js:9506:21)
at InjectableCompiler.factoryFor (C:\Users\Desktop\dev\Tapp\tapp-client\tapp\node_modules\@angular\compiler\bundles\compiler.umd.js:9570:32)
at InjectableCompiler.injectableDef (C:\Users\Desktop\dev\Tapp\tapp-client\tapp\node_modules\@angular\compiler\bundles\compiler.umd.js:9589:38)
at InjectableCompiler.compile (C:\Users\Desktop\dev\Tapp\tapp-client\tapp\node_modules\@angular\compiler\bundles\compiler.umd.js:9599:102)
at C:\Users\Desktop\dev\Tapp\tapp-client\tapp\node_modules\@angular\compiler\bundles\compiler.umd.js:20338:86
at Array.forEach (
at AotCompiler._emitPartialModule2 (C:\Users\Desktop\dev\Tapp\tapp-client\tapp\node_modules\@angular\compiler\bundles\compiler.umd.js:20338:21)
at C:\Users\Desktop\dev\Tapp\tapp-client\tapp\node_modules\@angular\compiler\bundles\compiler.umd.js:20331:44
at Array.reduce (
at AotCompiler.emitAllPartialModules2 (C:\Users\Desktop\dev\Tapp\tapp-client\tapp\node_modules\@angular\compiler\bundles\compiler.umd.js:20330:22)
at AngularCompilerProgram._emitRender2 (C:\Users\Desktop\dev\Tapp\tapp-client\tapp\node_modules\@angular\compiler-cli\src\transformers\program.js:318:31)
at AngularCompilerProgram.emit (C:\Users\Desktop\dev\Tapp\tapp-client\tapp\node_modules\@angular\compiler-cli\src\transformers\program.js:231:22)
at AngularCompilerPlugin._emit (C:\Users\Desktop\dev\Tapp\tapp-client\tapp\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:806:49)
It doesn't specify where this [] is that is breaking the compiling process hence i don't know where to go fix it.
I am also getting similar error
Angular CLI: 6.0.3
Node: 8.10.0
OS: darwin x64
Angular: 6.0.2
... animations, cdk, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
@angular-devkit/architect 0.6.3
@angular-devkit/build-angular 0.6.3
@angular-devkit/build-optimizer 0.6.3
@angular-devkit/core 0.6.3
@angular-devkit/schematics 0.6.3
@angular/cli 6.0.3
@ngtools/webpack 6.0.3
@schematics/angular 0.6.3
@schematics/update 0.6.3
rxjs 6.1.0
typescript 2.7.2
webpack 4.8.3
ng build --prod --build-optimizer --vendor-chunk --base-href=/static/
ERROR in : Error: Internal error: unknown identifier undefined
at Object.importExpr$$1 [as importExpr] (/Users/mandalpa/ai/synapse/frontend/app/synapse/node_modules/@angular/compiler/bundles/compiler.umd.js:20493:23)
at tokenExpr (/Users/mandalpa/ai/synapse/frontend/app/synapse/node_modules/@angular/compiler/bundles/compiler.umd.js:11721:39)
at providerDef (/Users/mandalpa/ai/synapse/frontend/app/synapse/node_modules/@angular/compiler/bundles/compiler.umd.js:11647:20)
at /Users/mandalpa/ai/synapse/frontend/app/synapse/node_modules/@angular/compiler/bundles/compiler.umd.js:11817:77
at Array.map (
at NgModuleCompiler.compile (/Users/mandalpa/ai/synapse/frontend/app/synapse/node_modules/@angular/compiler/bundles/compiler.umd.js:11817:44)
at AotCompiler._compileModule (/Users/mandalpa/ai/synapse/frontend/app/synapse/node_modules/@angular/compiler/bundles/compiler.umd.js:20438:32)
at /Users/mandalpa/ai/synapse/frontend/app/synapse/node_modules/@angular/compiler/bundles/compiler.umd.js:20357:66
at Array.forEach (
at AotCompiler._compileImplFile (/Users/mandalpa/ai/synapse/frontend/app/synapse/node_modules/@angular/compiler/bundles/compiler.umd.js:20357:19)
at /Users/mandalpa/ai/synapse/frontend/app/synapse/node_modules/@angular/compiler/bundles/compiler.umd.js:20347:70
at Array.map (
at AotCompiler.emitAllImpls (/Users/mandalpa/ai/synapse/frontend/app/synapse/node_modules/@angular/compiler/bundles/compiler.umd.js:20347:35)
at AngularCompilerProgram.generateFilesForEmit (/Users/mandalpa/ai/synapse/frontend/app/synapse/node_modules/@angular/compiler-cli/src/transformers/program.js:691:46)
at AngularCompilerProgram._emitRender2 (/Users/mandalpa/ai/synapse/frontend/app/synapse/node_modules/@angular/compiler-cli/src/transformers/program.js:284:27)
at AngularCompilerProgram.emit (/Users/mandalpa/ai/synapse/frontend/app/synapse/node_modules/@angular/compiler-cli/src/transformers/program.js:231:22)
I figured out my problem, I was making a Super class Injectable.
The same thing happened to me, your comment helped me. Thank you.
@ZackAfro what do you mean by "Super class Injectable". I am stuck with same error.
Make sure than you do not have this @Injectable()
tag in any of your super classes, as you cannot inject a Super class.
Make sure than you do not have this
@Injectable()
tag in any of your super classes, as you cannot inject a Super class.
Thanks man, I had the same problem too. You saved me a lot of pain.
I had the same problem.
The super-class-injectable-problem appeared in WARNINGs, so I thought I can ignore it for now. it would be better if they were errors.
also the error that appear is so undescriptive. which made me thought there is actually a problem with Angular, not me
Thanks. I had the same problem with @Injectable().
Hi! I had the same problem and while building I had
Warning: Can't resolve all parameters for MyService in /Users/.../my.service.ts: (?, ?). This will become an error in Angular v6.x
There is a class that extends another class (that Super class was already without Injectable()) and has constructor(protected readonly http)
I solved by adding type HttpClient explicitly for http.
Just for the record, it happened to me and it was a circular reference (for types only, not runtime code) with default exports.
Changing it to named exports fixed it:
// MyService.ts
- import OtherService from './OtherService';
+ import { OtherService } from './OtherService';
@Injectable(...)
- export default MyService { ... }
+ export MyService { ... }
// OtherService.ts
- import MyService from './MyService';
+ import {聽MyService } from './MyService';
@Injectable(...)
- export default OtherService { ... }
+ export OtherService { ... }
I experienced this issue after upgrading from Angular 7 to 8. I had a service which constructor had arguments that were not @Injectable()
, and thus had to make them so. I changed my service to this:
@Injectable()
export class MyService {
constructor (@Inject(MyClass) myClass: MyClass ) {} // had to make sure that all arguments could be injected.
}
Side note: You could also add the @Injectable()
-decorator to the definition of MyClass
instead of doing @Inject()
in the constructor of the service.
I am also getting similar error
Angular CLI: 6.0.3
Node: 8.10.0
OS: darwin x64
Angular: 6.0.2
... animations, cdk, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, routerPackage Version
@angular-devkit/architect 0.6.3
@angular-devkit/build-angular 0.6.3
@angular-devkit/build-optimizer 0.6.3
@angular-devkit/core 0.6.3
@angular-devkit/schematics 0.6.3
@angular/cli 6.0.3
@ngtools/webpack 6.0.3
@schematics/angular 0.6.3
@schematics/update 0.6.3
rxjs 6.1.0
typescript 2.7.2
webpack 4.8.3ng build --prod --build-optimizer --vendor-chunk --base-href=/static/
ERROR in : Error: Internal error: unknown identifier undefined
at Object.importExpr$$1 [as importExpr] (/Users/mandalpa/ai/synapse/frontend/app/synapse/node_modules/@angular/compiler/bundles/compiler.umd.js:20493:23)
at tokenExpr (/Users/mandalpa/ai/synapse/frontend/app/synapse/node_modules/@angular/compiler/bundles/compiler.umd.js:11721:39)
at providerDef (/Users/mandalpa/ai/synapse/frontend/app/synapse/node_modules/@angular/compiler/bundles/compiler.umd.js:11647:20)
at /Users/mandalpa/ai/synapse/frontend/app/synapse/node_modules/@angular/compiler/bundles/compiler.umd.js:11817:77
at Array.map ()
at NgModuleCompiler.compile (/Users/mandalpa/ai/synapse/frontend/app/synapse/node_modules/@angular/compiler/bundles/compiler.umd.js:11817:44)
at AotCompiler._compileModule (/Users/mandalpa/ai/synapse/frontend/app/synapse/node_modules/@angular/compiler/bundles/compiler.umd.js:20438:32)
at /Users/mandalpa/ai/synapse/frontend/app/synapse/node_modules/@angular/compiler/bundles/compiler.umd.js:20357:66
at Array.forEach ()
at AotCompiler._compileImplFile (/Users/mandalpa/ai/synapse/frontend/app/synapse/node_modules/@angular/compiler/bundles/compiler.umd.js:20357:19)
at /Users/mandalpa/ai/synapse/frontend/app/synapse/node_modules/@angular/compiler/bundles/compiler.umd.js:20347:70
at Array.map ()
at AotCompiler.emitAllImpls (/Users/mandalpa/ai/synapse/frontend/app/synapse/node_modules/@angular/compiler/bundles/compiler.umd.js:20347:35)
at AngularCompilerProgram.generateFilesForEmit (/Users/mandalpa/ai/synapse/frontend/app/synapse/node_modules/@angular/compiler-cli/src/transformers/program.js:691:46)
at AngularCompilerProgram._emitRender2 (/Users/mandalpa/ai/synapse/frontend/app/synapse/node_modules/@angular/compiler-cli/src/transformers/program.js:284:27)
at AngularCompilerProgram.emit (/Users/mandalpa/ai/synapse/frontend/app/synapse/node_modules/@angular/compiler-cli/src/transformers/program.js:231:22)
Super classes means default exports.
So you shouldn't export any Injectable()
as default.
ERROR in : Error: Internal error: unknown identifier 16
I had this problem by trying to provide
material constants (in the hope of overwriting them):
@Component({
...
providers: [
{provide: SELECT_PANEL_PADDING_X, useValue: 50},
],
})
Apparently material constants are constant [wow.gif]
The error message is VERY VERY confusing.
Can we know what file exactly wrong ?
@redplane have you got any warning showing when compiling ? It is possibly one of them. It only shows as errors but will actually break your build... Make sure your clear up all of them.
Same problem. I am using Akita and didn't provide an empty constructor for a subclass of EntityStore
. Works after adding that.
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._
Most helpful comment
I figured out my problem, I was making a Super class Injectable.