Reputation: 901
Running the following build command
ng build --prod --aot
And getting the following error (a standard ng build works)
ERROR in Illegal state: symbol without members expected, but got {"filePath":"D:/Projects/app/node_modules/@angular/platform-browser/platform-browser.d.ts","name":"platform_browser_private","members":["BROWSER_SANITIZATION_PROVIDERS"]}.
app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { AppComponent } from './app.component';
import { NavBarComponent } from './navbar.component';
import { FooterComponent } from './footer.component';
import { MainComponent } from './main.component';
//Services
import { ProductService } from './services/product.service';
import { CategoryService } from './services/category.service';
//Pages
import { SubscriptionComponent } from './subscription/subscription.component';
import { ProductsComponent } from './products/products.component';
import { ProductComponent } from './product/product.component';
import { FrontpageHeaderComponent } from './frontpage-header.component';
//Global
import { RouterModule } from '@angular/router';
import { HeaderSecondLevelComponent } from './header-second-level.component';
import { NodeModule } from 'angular2-platform-node'
import { AppRoutingModule } from './app-routing.module';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
//Angular Material
import { MaterialModule } from '@angular/material';
import 'hammerjs';
@NgModule({
declarations: [
AppComponent,
NavBarComponent,
FooterComponent,
MainComponent,
SubscriptionComponent,
ProductsComponent,
ProductComponent,
FrontpageHeaderComponent,
HeaderSecondLevelComponent,
],
entryComponents: [],
imports: [
BrowserModule,
FormsModule,
[MaterialModule],
HttpModule,
AppRoutingModule,
BrowserAnimationsModule
],
providers: [ProductService, CategoryService, BrowserModule],
bootstrap: [AppComponent]
})
export class AppModule { }
Upvotes: 2
Views: 940
Reputation: 901
To fix this I ran the following commands from the angular CLI install guide, I now get a clean prod aot build.
Note: the section that I think fixed the issues was removing all modules so that they were refreshed, make sure that part runs correctly and that the files are not locked out etc. so you get a clean refresh.
npm uninstall -g angular-cli
npm uninstall --save-dev angular-cli
To update Angular CLI to a new version, you must update both the global package and your project's local package.
Global package:
npm uninstall -g @angular/cli
npm cache clean
npm install -g @angular/cli@latest
Local project package:
rm -rf node_modules dist # use rmdir /S/Q node_modules dist in Windows Command Prompt; use rm -r -fo node_modules,dist in Windows PowerShell
npm install --save-dev @angular/cli@latest
npm install
Upvotes: 2