Error: Cannot determine the module for component DevicePage!


#1

Hi everyone, this is my first post. I have been looking around for a couple days now trying to solve this problem but I have no idea what’s going on. I created a new page and made used the side menu starter code as a guide for using that page. I already added it to declarations and entryComponents but every time I run “Ionic build android” it gives me this error and when I go and look at app.module the code I added was deleted from the file. I would really appreciate anyone that can point me in the right direction as I can’t find anything that’s wrong with it.

Here’s my app.module.ts
import { NgModule } from ‘@angular/core’;
import { IonicApp, IonicModule } from ‘ionic-angular’;
import { MyApp } from ‘./app.component’;
import { DevicePage } from ‘…/pages/device/device’;
import { HomePage } from ‘…/pages/home/home’;
import { DeviceService } from ‘./device.service’;

@NgModule({
  declarations: [
    MyApp,
    DevicePage,
    HomePage
  ],
  imports: [
    IonicModule.forRoot(MyApp)
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    DevicePage,
    HomePage
  ],
  providers: [DeviceService]
})
export class AppModule {}

app.component.ts
import { Component, ViewChild } from ‘@angular/core’;
import { Platform, Nav } from ‘ionic-angular’;
import { StatusBar, Splashscreen } from ‘ionic-native’;
import { DeviceService } from ‘./device.service’;
import { HomePage } from ‘…/pages/home/home’;
import { DevicePage } from ‘…/pages/device/device’;

@Component({
  templateUrl: 'app.html'
})
export class MyApp {
  @ViewChild(Nav) nav: Nav;

  rootPage = HomePage;
  subscription;
  pages:Array<{device: any, component: any}>;

  constructor(platform: Platform, private deviceService: DeviceService) {
    platform.ready().then(() => {
      this.subscription = this.deviceService.getDeviceConnectEmitter().subscribe(device => this.handleDeviceEvent(device));
      StatusBar.styleDefault();
      Splashscreen.hide();
    });
  }

  handleDeviceEvent(device) {
    this.pages.push({device: device, component: DevicePage});
  }

  openPage(page) {
    this.nav.setRoot(page.component);
  }

  goToPage(page) {
    if(page !== undefined) {
      this.nav.push(page);
    } else {
      this.nav.push(this.rootPage);
    }
  }
}

app.html
<ion-menu [content]=“content”>


Menu

  <ion-content>
    <ion-list>
      <button menuClose ion-item *ngFor="let page of pages" (click)="goToPage(page)">
        {{p.device.name}}
        {{p.device.id}}
      </button>
    </ion-list>

    <button ion-button icon-only (click)="goToPage()">
      <ion-icon name="add-circle"></ion-icon>
    </button>
  </ion-content>
</ion-menu>

<!-- Disable swipe-to-go-back because it's poor UX to combine STGB with side menus -->
<ion-nav [root]="rootPage" #content swipeBackEnabled="false"></ion-nav>

And then here’s my Npm-debug.log

0 info it worked if it ends with ok
1 verbose cli [ ‘/usr/local/bin/node’,
1 verbose cli ‘/usr/local/bin/npm’,
1 verbose cli ‘run’,
1 verbose cli ‘ionic:build’,
1 verbose cli ‘–’ ]
2 info using npm@3.10.8
3 info using node@v7.0.0
4 verbose run-script [ ‘preionic:build’, ‘ionic:build’, ‘postionic:build’ ]
5 info lifecycle ionic-hello-world@~preionic:build: ionic-hello-world@
6 silly lifecycle ionic-hello-world@~preionic:build: no script for preionic:build, continuing
7 info lifecycle ionic-hello-world@~ionic:build: ionic-hello-world@
8 verbose lifecycle ionic-hello-world@~ionic:build: unsafe-perm in lifecycle true
9 verbose lifecycle ionic-hello-world@~ionic:build: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/home/jmundo/Documents/Projects/litebrush/node_modules/.bin:/home/jmundo/bin:/home/jmundo/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/jmundo/Android/Sdk/tools
10 verbose lifecycle ionic-hello-world@~ionic:build: CWD: /home/jmundo/Documents/Projects/litebrush
11 silly lifecycle ionic-hello-world@~ionic:build: Args: [ ‘-c’, ‘ionic-app-scripts build’ ]
12 silly lifecycle ionic-hello-world@~ionic:build: Returned: code: 1 signal: null
13 info lifecycle ionic-hello-world@~ionic:build: Failed to exec ionic:build script
14 verbose stack Error: ionic-hello-world@ ionic:build: ionic-app-scripts build
14 verbose stack Exit status 1
14 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:255:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:877:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid ionic-hello-world@
16 verbose cwd /home/jmundo/Documents/Projects/litebrush
17 error Linux 4.4.0-47-generic
18 error argv “/usr/local/bin/node” “/usr/local/bin/npm” “run” “ionic:build” "–"
19 error node v7.0.0
20 error npm v3.10.8
21 error code ELIFECYCLE
22 error ionic-hello-world@ ionic:build: ionic-app-scripts build
22 error Exit status 1
23 error Failed at the ionic-hello-world@ ionic:build script ‘ionic-app-scripts build’.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the ionic-hello-world package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error ionic-app-scripts build
23 error You can get information on how to open an issue for this project with:
23 error npm bugs ionic-hello-world
23 error Or if that isn’t available, you can get their info via:
23 error npm owner ls ionic-hello-world
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]