Typescript error: Cannot find module 'os'. how to resolve?

Asked

Viewed 463 times

-2

app.component.ts

import { Component, ViewChild } from '@angular/core';
import { Platform, NavController } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';

import { Storage } from '@ionic/Storage';
import { HomePage } from '../pages/home/home';
import { LoginPage } from '../pages/login/login';
import { RegisterPage } from '../pages/register/register';
import { platform } from 'os';

@Component({
  templateUrl: 'app.html'
})
export class MyApp {
  public get platform(): Platform {
    return this._platform;
  }
  public set platform(value: Platform) {
    this._platform = value;
  }
  @ViewChild('content') nav: NavController;
  rootPage:any;
  initiallization: any;
  initiallizationApp: any;
  Platform: any;
  statusBar: any;
  splashScreen: any;
  Storage: any;

  constructor( 
  private _platform: Platform,
  public StatusBar: StatusBar, 
  public SplashScreen: SplashScreen, 
  private storage: Storage) {
    this.initiallizationApp();
  }
    initializeApp(){
      this.platform.ready().then(()=> {
      this.statusBar.styleDefault();
      this.splashScreen.hide();

  });

  this.storage.get('session_storage').then((res)=>{
    if(res == null){
      this.rootPage = LoginPage;
    }else{
      this.rootPage = HomePage;
    }
  });


versão ionic 3.9.5
angular: 5.2.11
node: 10.15.3

}
}
  • Edit: I’ve already used the search

1 answer

0


On the line that generated the error replace it with:

import * as os from 'os';

Browser other questions tagged

You are not signed in. Login or sign up in order to post.