Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compile Error: compiler-cli/src/ngtools_api has no exported member NgTools_InternalApi_NG_2

my ng serve is broken currently with the following error message:

ERROR in node_modules/@angular/compiler-cli/index.d.ts(20,10): 
error TS2305: 
Module '"./node_modules/@angular/compiler-cli/src/ngtools_api"' 
has no exported member 'NgTools_InternalApi_NG_2'.

(module path shortened to relative project location for privacy)

This came out of the blue and i'm very confused, where to find this bug.

A search on Google/ Github brought the following threads:

  • Using @angular/compiler-cli throws a compile-time error because of missing declaration of NgTools_InternalApi_NG_2
  • PR: fix(compiler-cli): no exported member 'NgTools_InternalApi_NG_2' #23631

But these are not really helpful to me. I'm not actively using NgTools_InternalApi_NG_2, at least not that I'm aware of.
It could be that some other library is using some things if compiler-cli package internally, but I think that in this case the error would have shown up earlier.

Background

The goal of that branch was to transform some component from using plain material-components-web to using angular-material components. I only have this problem in one specific branch, but I'm not aware of using NgTools_InternalApi_NG_2 in there. Finding the library, which may use NgTools_InternalApi_NG_2 could be very difficult I think.

Next Idea

Since I only have this problem in one branch and my master is fine, I'll start digging into all the changes on my branch above master to probably find something. When I'm done I think that I'll be able to provide some code on how to reproduce the Problem.

In the meantime, if somebody has an idea where to look for, I would highly appreciate it!

like image 562
Benjamin Jesuiter Avatar asked Aug 30 '18 14:08

Benjamin Jesuiter


1 Answers

Now I've found the answer myself.

While transforming the code from material-components-web to angular-material components i wanted to use a Span class, hoping that Typescript whould have a class like Span extends HTMLElement for typed access to this HTMLElement.

Unfortunately, @angular/compiler-cli does also have a Span class, which was auto-imported by Webstorm as I tried to use a Span class.
import {Span} from '@angular/compiler-cli';

So, if someone get's stuck at a similar problem, search your codebase for any imports or other usages of @angular/compiler-cli. If you remove them, it should work perfectly fine again. 🙂

like image 138
Benjamin Jesuiter Avatar answered Oct 04 '22 23:10

Benjamin Jesuiter