title: Uncaught Error: Cannot find module 'tslib' | Updating Angular Project Version 10 to 11
body: <p>When I updated angular project from 10 to 11 using using angular cli update command , i was not gtetitng any error while compiling but when run on browser our site then its showing error like this.</p>
  <p>I have installed and uninstalled tslib different version but still its showing error.</p>
  <p>Deleted node modules many times and then run npm i , ng update but getting same error.</p>
  <p>Error is</p>
  <pre><code>Uncught Error: Cannot find module 'tslib'
  at webpackEmptyContext (src sync:2)
  at util.js:20
  at util.js:10
  at Object.Yoyx (util.js:16)
  at __webpack_require__ (bootstrap:79)
  at Module.WZuZ (leftbar.component.ts:2)
  at __webpack_require__ (bootstrap:79)
  at Module.J7Q4 (zone.model.ts:79)
  at __webpack_require__ (bootstrap:79)
  at Module.vY5A (app-routing.module.ts:2)
  </code></pre>
  <p>package.json</p>
  <pre><code>{
    &quot;name&quot;: &quot;Project Name&quot;,
    &quot;version&quot;: &quot;0.0.0&quot;,
    &quot;scripts&quot;: {
       &quot;ng&quot;: &quot;ng&quot;,
       &quot;start&quot;: &quot;ng serve --proxy-config proxy.conf.json&quot;,
       &quot;build&quot;: &quot;ng build&quot;,
       &quot;test&quot;: &quot;ng test&quot;,
       &quot;lint&quot;: &quot;ng lint&quot;,
       &quot;e2e&quot;: &quot;ng e2e&quot;
    },
    &quot;private&quot;: true,
    &quot;dependencies&quot;: {
    &quot;@angular/animations&quot;: &quot;^11.1.1&quot;,
    &quot;@angular/cdk&quot;: &quot;^11.1.1&quot;,
    &quot;@angular/common&quot;: &quot;~11.1.1&quot;,
    &quot;@angular/compiler&quot;: &quot;~11.1.1&quot;,
    &quot;@angular/core&quot;: &quot;^11.1.1&quot;,
    &quot;@angular/forms&quot;: &quot;~11.1.1&quot;,
    &quot;@angular/http&quot;: &quot;^7.2.16&quot;,
    &quot;@angular/localize&quot;: &quot;^11.1.1&quot;,
    &quot;@angular/material&quot;: &quot;^11.1.1&quot;,
    &quot;@angular/platform-browser&quot;: &quot;~11.1.1&quot;,
    &quot;@angular/platform-browser-dynamic&quot;: &quot;~11.1.1&quot;,
    &quot;@angular/router&quot;: &quot;~11.1.1&quot;,
    &quot;@cedx/ngx-webstorage&quot;: &quot;^3.7.0&quot;,
    &quot;@fortawesome/angular-fontawesome&quot;: &quot;^0.4.0&quot;,
    &quot;@fortawesome/fontawesome-free-solid&quot;: &quot;^5.0.13&quot;,
    &quot;@fortawesome/fontawesome-svg-core&quot;: &quot;^1.2.34&quot;,
    &quot;@fortawesome/free-solid-svg-icons&quot;: &quot;^5.15.2&quot;,
    &quot;@ng-bootstrap/ng-bootstrap&quot;: &quot;^4.2.2&quot;,
    &quot;@ng-bootstrap/schematics&quot;: &quot;^2.0.0-alpha.1&quot;,
    &quot;@types/jquery&quot;: &quot;^3.5.5&quot;,
    &quot;angular-bootstrap-md&quot;: &quot;^7.5.4&quot;,
    &quot;angular-image-slider&quot;: &quot;0.0.8&quot;,
    &quot;angular-popper&quot;: &quot;^2.0.1&quot;,
    &quot;bn-ng-idle&quot;: &quot;^1.0.1&quot;,
    &quot;bootstrap&quot;: &quot;^4.6.0&quot;,
    &quot;core-js&quot;: &quot;^2.6.12&quot;,
    &quot;file-saver&quot;: &quot;^2.0.5&quot;,
    &quot;gauge-js&quot;: &quot;^1.0.5&quot;,
    &quot;html2canvas&quot;: &quot;^1.0.0-rc.7&quot;,
    &quot;jquery&quot;: &quot;^3.5.1&quot;,
    &quot;jspdf&quot;: &quot;^1.5.3&quot;,
    &quot;mqtt&quot;: &quot;^3.0.0&quot;,
    &quot;multer&quot;: &quot;^1.4.2&quot;,
    &quot;ng2-file-upload&quot;: &quot;^1.4.0&quot;,
    &quot;ngx-bootstrap&quot;: &quot;^4.3.0&quot;,
    &quot;ngx-cookie-service&quot;: &quot;^2.4.0&quot;,
    &quot;ngx-pagination&quot;: &quot;^5.0.0&quot;,
    &quot;ngx-ui-loader&quot;: &quot;^7.2.2&quot;,
    &quot;ngx-webstorage-service&quot;: &quot;^4.1.0&quot;,
    &quot;phaser&quot;: &quot;^3.52.0&quot;,
    &quot;popper.js&quot;: &quot;^1.16.1&quot;,
    &quot;rxjs&quot;: &quot;^6.6.3&quot;,
    &quot;rxjs-compat&quot;: &quot;^6.6.3&quot;,
    &quot;tslib&quot;: &quot;^2.1.0&quot;,
    &quot;worker-plugin&quot;: &quot;^3.2.0&quot;,
    &quot;zone.js&quot;: &quot;~0.10.2&quot;
   },
   &quot;devDependencies&quot;: {
   &quot;@angular-devkit/build-angular&quot;: &quot;~0.1101.2&quot;,
   &quot;@angular/cli&quot;: &quot;~11.1.2&quot;,
   &quot;@angular/compiler-cli&quot;: &quot;~11.1.1&quot;,
   &quot;@angular/language-service&quot;: &quot;~11.1.1&quot;,
   &quot;@fortawesome/fontawesome-free&quot;: &quot;^5.15.2&quot;,
   &quot;@types/jasmine&quot;: &quot;~3.6.0&quot;,
   &quot;@types/jasminewd2&quot;: &quot;^2.0.8&quot;,
   &quot;@types/node&quot;: &quot;^12.11.1&quot;,
   &quot;codelyzer&quot;: &quot;^6.0.0&quot;,
   &quot;jasmine-core&quot;: &quot;~3.6.0&quot;,
   &quot;jasmine-spec-reporter&quot;: &quot;~5.0.0&quot;,
   &quot;karma&quot;: &quot;~5.2.3&quot;,
   &quot;karma-chrome-launcher&quot;: &quot;~3.1.0&quot;,
   &quot;karma-coverage-istanbul-reporter&quot;: &quot;~3.0.2&quot;,
   &quot;karma-jasmine&quot;: &quot;~4.0.0&quot;,
   &quot;karma-jasmine-html-reporter&quot;: &quot;^1.5.0&quot;,
   &quot;protractor&quot;: &quot;~7.0.0&quot;,
   &quot;ts-node&quot;: &quot;~7.0.0&quot;,
   &quot;tslint&quot;: &quot;~6.1.0&quot;,
   &quot;typescript&quot;: &quot;~4.0.5&quot;
   },
   &quot;resolutions&quot;: {
   &quot;webpack&quot;: &quot;^5.0.0&quot;
   }  
  }
  </code></pre>
  <p>On that page i have error</p>
  <pre><code>          import { Component, OnInit,EventEmitter } from '@angular/core';
            import { NgForm } from '@angular/forms';
            import { ZoneService } from '../zone.service';
            import {Router} from '@angular/router';
            import {NgxUiLoaderService} from 'ngx-ui-loader';
            import { stringify } from '@angular/compiler/src/util';
  
            @Component({
              selector: 'app-forgetpass',
              templateUrl: './forgetpass.component.html',
              styleUrls: ['./forgetpass.component.css']
            })
            export class ForgetpassComponent implements OnInit {
              public otp;
              public wrongPassword =  false;
              public otpCheck: boolean = false;
              public  email;
              public otpForm = true;
              public forgetPass = false;
              constructor(private _zoneservice: ZoneService,
                          private router: Router,
                          private ngxLoader: NgxUiLoaderService){ }
              
              ngOnInit(){
                this.ngxLoader.start();
                this.isLogIn()
                this.ngxLoader.stop();
                
              }
  
            /////////////////to check if user already logged in or not ////////////////
  
              isLogIn(){
                this._zoneservice.isLogIn().subscribe(data =&gt; {
                  if(data[0].mssg == 'success'){
                    var username = data[0].username
                    var client = data[0].client;
                    var Cid = data[0].Cid;
                    var image = data[0].image
              
                    // alert(Cid)     
                    //  alert('heh')
  
                    localStorage.setItem('username',username)
                    localStorage.setItem('Cid',Cid)
                    localStorage.setItem('client',client)
                    localStorage.setItem('Image',image)
                  //  console.log('new',localStorage)
                    this.router.navigate(['/brs/home',username,client]);
                  }
                })
              }
  
              ///////////////// for forget password ////////////////////////
            onforget(form: NgForm){
              //  alert(&quot;hey&quot;)
              var email = form.value.email;
              var user = form.value.user;
              this._zoneservice.forgetpassword(email,user)
              .subscribe
              (
                data=&gt;
                {  
                  this.otp = data[0].otp
                  // console.log(data[0].mssg);
                  console.log(data)
                  alert(this.otp);
                  
                  if(data[0].mssg == &quot;otp_sent&quot;){
                    (&lt;HTMLInputElement&gt;document.getElementById(&quot;otp_check&quot;)).style.display = &quot;block&quot;;
                    (&lt;HTMLInputElement&gt;document.getElementById(&quot;otp_sent&quot;)).style.display = &quot;none&quot;;
                    this.otpForm=  true;
                    //  alert('redirect')
                    // this.router.navigate(['/forget_password'])
                    
                  }
                  
                })
              
                }
                
                  ///////////////// for otp check ////////////////////
                otp_check(form: NgForm){
                    //  alert(&quot;email&quot;);
                  var enteredOtp = form.value.otp;
                this.email = (&lt;HTMLInputElement&gt;document.getElementById(&quot;email&quot;)).value;
                //  alert(email);
                //  alert(enteredOtp);
                //  alert(this.otp);
                if(enteredOtp==this.otp){
                  this.otpCheck =  true
                  //this.router.navigate(['/forget_password']);
  
                }
  
                }
  
  
                //////////////////    for setting new password //////////////////////
                change_pass(form: NgForm){
                    
                var password = form.value.password;
                var Confirm_password = form.value.Confirm_password;
  
                if(password == Confirm_password){
                
                  this._zoneservice.changepassone(password,this.email)
                .subscribe
                (
                  data=&gt;
                  { 
                    //  console.log(data);
                    if(data[0].mssg == &quot;success&quot;){
                    //  alert('Password Change');
                      this.router.navigate(['']);
                    }
                    else{
                      alert('Some Error!');
                    }
                  })
                }
                else{
                  alert(&quot;Password And Confirm Password doesn't match.&quot;)
                }
                }
  
  
                ///////////////// for login //////////////////////
              
              onLogin(form: NgForm){
  
              var result ;
              var email : string;
            var password = '';
            var username = '';
            var client : string;
            var Cid:any;
            var image : string;
            var loginValidate = new EventEmitter();
              // alert(form.value.username);
              if(form.invalid){
                return;
              }
              const loginData = {
                username:form.value.username,
                password: form.value.password
              };
              //console.log(loginData);
              this._zoneservice.login(loginData)
              .subscribe
              (
                data=&gt;
                {
                  result = data;
                // console.log(result);
                  if(result[0].mssg == &quot;Success&quot;){
                    username = result[0].username;
                    image = result[0].image;
                    client = result[0].client;
                    Cid = result[0].Cid;
                  //  console.log(result[0])
                    var cur_date = new Date();
                  localStorage.setItem('username',username);
                  localStorage.setItem('image',image);
                  localStorage.setItem('Cid',Cid);
                  localStorage.setItem('client',client);
                  localStorage.setItem('op_start',''+cur_date.getTime());
                  localStorage.setItem('LoginTime', stringify(cur_date));
                  console.log(stringify(cur_date));
                  //console.log(localStorage)
                // alert(username);
  
                    this.router.navigate(['/brs/home',username,client]);
                  //  alert(image)
                  }
                  else{
                    this.wrongPassword = true;
                    this.router.navigate([''])
  
                  }
                }
              )
  
  
            }
              
              //////////////////for opening forget password  ///////////// 
  
            forgetPassButton(){
              this.forgetPass= true;
            // this.router.navigate(['/forget_password']);
              
            }
  
            }
  </code></pre>