ng serve fails with "ERROR in Debug failure: no local name provided for NamespaceImport"
See original GitHub issueπ Bug report
Command (mark with an x
)
- new
- build
- serve
- test
- e2e
- generate
- add
- update
- lint
- xi18n
- run
- config
- help
- version
- doc
Is this a regression?
Yes, the same app was working with Angular 8 and CLI 8.
Description
A clear and concise description of the problem...Running ng serve consistently fails with the stack trace reported below.
π¬ Minimal Reproduction
npm install ng serve Itβs a private repo and the exception does not refer to any specific code in the repo. It seems to be a generic error in compiler-cli itself.
π₯ Exception or Error
ERROR in Debug failure: no local name provided for NamespaceImport
F:\webstr\node_modules\@angular\compiler-cli\src\ngtsc\core\src\compiler.js:342
finally { if (e_2) throw e_2.error; }
^
Error: Debug failure: no local name provided for NamespaceImport
at extractModuleAndNameFromImport (F:\webstr\node_modules\@angular\compiler-cli\src\ngtsc\reflection\src\type_to_value.js:173:27)
at Object.typeToValue (F:\webstr\node_modules\@angular\compiler-cli\src\ngtsc\reflection\src\type_to_value.js:59:28)
at F:\webstr\node_modules\@angular\compiler-cli\src\ngtsc\reflection\src\typescript.js:76:58
at Array.map (<anonymous>)
at TypeScriptReflectionHost.getConstructorParameters (F:\webstr\node_modules\@angular\compiler-cli\src\ngtsc\reflection\src\typescript.js:55:36)
at Object.getConstructorDependencies (F:\webstr\node_modules\@angular\compiler-cli\src\ngtsc\annotations\src\util.js:32:36)
at extractInjectableCtorDeps (F:\webstr\node_modules\@angular\compiler-cli\src\ngtsc\annotations\src\injectable.js:233:38)
at InjectableDecoratorHandler.analyze (F:\webstr\node_modules\@angular\compiler-cli\src\ngtsc\annotations\src\injectable.js:71:31)
at TraitCompiler.analyzeTrait (F:\webstr\node_modules\@angular\compiler-cli\src\ngtsc\transform\src\compilation.js:341:40)
at analyze (F:\webstr\node_modules\@angular\compiler-cli\src\ngtsc\transform\src\compilation.js:293:58)
π Your Environment
Angular CLI: 9.0.5
Node: 12.13.1
OS: win32 x64
Angular: 9.0.5
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.900.5
@angular-devkit/build-angular 0.900.5
@angular-devkit/build-optimizer 0.900.5
@angular-devkit/build-webpack 0.900.5
@angular-devkit/core 9.0.5
@angular-devkit/schematics 9.0.5
@angular/cdk 9.1.2
@angular/material 9.1.2
@ngtools/webpack 9.0.5
@schematics/angular 9.0.5
@schematics/update 0.900.5
rxjs 6.5.4
typescript 3.7.5
webpack 4.41.2
Anything else relevant?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:21 (11 by maintainers)
Top Results From Across the Web
Angular ng serve Error in Debug Failure - Stack Overflow
I did not changed anything in my code from my last correct build. This error just randomly appeared. I tried to remove my...
Read more >Angular CLI - ng serve Command - Tutorialspoint
Sr.No. Option & Syntax Description
2 ββaot=true|false Build using Ahead of Time compilation.
3 ββbaseHref=baseHref Base url for the application being built.
7 ββdeployUrl=deployUrl URL where...
Read more >Unable to Run Angular CLI Server β Cannot GET
Failed to restore plugin βcordova-plugin-ionic-webviewβ from config.xml. You might need to try adding it again. Error: Using βΒ ...
Read more >Release 7.6.1 The IPython Development Team
Failing to do so on Python 2 may lead to a broken IPython install. ... Serving local files no longer needs the files/...
Read more >Stardog Platform Release Notes
Named graph permissions are not restored properly from db backup ... Provide an error when literals and IRIs exceed their limits into the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Maximaximum Itβs been merged into the 9.1.x branch just after the release of 9.1.1, so it will be included in 9.1.2 next week. Releases typically go out on Wednesdays.
@Maximaximum This is definitely a bug in the compiler. The compiler attempts to convert the
MemoryStorage
type declaration (for thememoryStorage
parameter in the constructor) to a value expression that is used as DI token. In this case, it doesnβt know how to handle the namespace import (itβs actually invalid to refer toMemoryStorage
as a value, the workaround using"allowSyntheticDefaultImports"
is then required to expressMemoryStorage
as a value), so it throws.However, the type-to-value conversion is irrelevant in this case because there an explicit DI token provided using the
@Inject
decorator. As such, the compiler should not crash when it fails to convert a type to a value, as that may be handled using an@Inject
decorator.