question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:21 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
JoostKcommented, Apr 10, 2020

@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.

1reaction
JoostKcommented, Mar 16, 2020

@Maximaximum This is definitely a bug in the compiler. The compiler attempts to convert the MemoryStorage type declaration (for the memoryStorage 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 to MemoryStorage as a value, the workaround using "allowSyntheticDefaultImports" is then required to express MemoryStorage 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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found