title: Angular 5: ERROR in src/app/app.module.ts(24,24): error TS2307: Cannot find module 'https'
body: <p>I am getting an error when running "ng serve" for Angular. I have seen some other issues with the same message number but they are for Angular 2, Angular 4.x, etc.</p>
  
  <p>What can I do to resolve the problem?</p>
  
  <p>Below is the <strong>app.module.ts</strong> file</p>
  
  <p>TIA</p>
  
  <p><strong>UPDATE-STILL HAVING THE PROBLEM</strong></p>
  
  <pre><code>I believe I marked the message resolved too early :) I am getting the following errors when running `ng serve` under Angular 5:
  
  ERROR in src/app/app.module.ts(24,24): error TS2307: Cannot find module 'https'.
  src/app/pages/auth-admin/admin-model/user.ts(1,35): error TS2307: Cannot find module 'constants'.
  src/app/pages/auth-admin/admin-services/admin-services/admin-services.service.ts(5,25): error TS2307: Cannot find module 'cluster'.
  webpack: Failed to compile.
  </code></pre>
  
  <p>If I save a document, then the "webpack" compiles. I had thought about upgrading the system (in hopes that this would resolve the problem) but am not sure if that would be the case.</p>
  
  <p>Any assistance on how to come about the issue is appreciated.</p>
  
  <p>TIA</p>
  
  <p><strong>UPDATE - FOUND OUT WHAT THE PROBLEM WAS</strong>
  Basically, I did not understand the error message :-|</p>
  
  <p>I thought it had something to do with my version of Angular 5 - so - I upgraded using the following info:</p>
  
  <p>SOURCE: <a href="https://github.com/angular/angular-cli/issues/4391" rel="noreferrer">https://github.com/angular/angular-cli/issues/4391</a></p>
  
  <pre><code>[updating globally]
  npm uninstall -g angular-cli
  npm cache clean
  npm install -g @angular/cli@latest
  
  [ updating the project ]
  rm -rf node_modules dist
  npm uninstall --save-dev angular-cli
  npm install --save-dev @angular/cli@latest
  npm install
  ng update
  </code></pre>
  
  <p>I tried to start the server with <code>ng serve</code></p>
  
  <p>The message I got was:</p>
  
  <pre><code>ERROR in src/app/app.module.ts(24,24): error TS2307: Cannot find module 'https'.
  src/app/pages/auth-admin/admin-model/user.ts(1,35): error TS2307: Cannot find module 'constants'.
  src/app/pages/auth-admin/admin-services/admin-services/admin-services.service.ts(5,25): error TS2307: Cannot find module 'cluster'.
  </code></pre>
  
  <p>I actually checked the files that were mentioned in the error message and saw something like this (which was in <strong>app.module.ts</strong>)</p>
  
  <blockquote>
    <p>import { Server } from 'https';</p>
  </blockquote>
  
  <p>as an example.</p>
  
  <p>The same applied to the other files. I do not know how they got there - but - I commented them out and the server started. So again, I did not really get the message. New to Angular though.</p>
  
  <p>TIA</p>
  
  <p><strong>app.module.ts</strong></p>
  
  <pre><code>    import { BrowserModule } from '@angular/platform-browser';
      import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
      import { NgModule } from '@angular/core';
  
      import { AgmCoreModule } from '@agm/core';
      import { CalendarModule } from 'angular-calendar';
  
      import { routing } from './app.routing';
      import { AppSettings } from './app.settings';
  
      import { AppComponent } from './app.component';
      import { NotFoundComponent } from './pages/errors/not-found/not-found.component';
  
  
      import { FormsModule } from '@angular/forms';
  
  
      import { AdminServicesService } from './pages/auth-admin/admin-services/admin-services/admin-services.service';
      import { Server } from 'https';
  
  
      import 'rxjs/add/operator/switchMap';
      import 'rxjs/add/operator/map';
      import 'rxjs/add/operator/shareReplay';
  
  
      import { HttpClientModule } from '@angular/common/http';
  
  
  @NgModule({
    declarations: [
      AppComponent,
      NotFoundComponent
    ],
    imports: [
      HttpClientModule,
      BrowserModule,
      FormsModule,
      BrowserAnimationsModule,
      AgmCoreModule.forRoot({
        apiKey: 'AIzaSyDe_oVpi9eRSN99G4o6TwVjJbFBNr58NxE'
      }),
      CalendarModule.forRoot(),
      routing
    ],
    providers: [ AppSettings, AdminServicesService ],
    bootstrap: [ AppComponent ]
  })
  export class AppModule { }
  </code></pre>
  
  <p><strong>currently running</strong></p>
  
  <pre><code>Angular CLI: 1.6.1
  Node: 8.9.4
  OS: win32 x64
  Angular: 5.1.1
  ... animations, common, compiler, compiler-cli, core, forms
  ... http, language-service, platform-browser
  ... platform-browser-dynamic, router
  
  @angular/cli: 1.6.1
  @angular-devkit/build-optimizer: 0.0.38
  @angular-devkit/core: 0.0.23
  @angular-devkit/schematics: 0.0.42
  @ngtools/json-schema: 1.1.0
  @ngtools/webpack: 1.9.1
  @schematics/angular: 0.1.13
  typescript: 2.4.2
  webpack: 3.10.0
  </code></pre>