Skip to content

WebRTCModule could not be resolved to an NgModule class #58

@AniketBhadane

Description

@AniketBhadane

We have Nativescript in our Angular 10 application.

For web, we have RTCPeerConnection working

But for Nativescript on Android, we planned to used this plugin.

When I do tns build android, I get the following error:

ERROR in node_modules/nativescript-webrtc-plugin/angular/index.d.ts:4:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.

This likely means that the library (nativescript-webrtc-plugin/angular) which declares WebRTCModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

4 export declare class WebRTCModule {

The app.module.tns.ts is:

import { HttpClient } from '@angular/common/http';
import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
import { NativeScriptModule, NativeScriptHttpClientModule } from '@nativescript/angular';
import { AppRoutingModule } from '@src/app/app-routing.module.tns';
import { AppComponent } from '@src/app/app.component';
import { WebRTCModule } from "nativescript-webrtc-plugin/angular";

@NgModule({
  declarations: [AppComponent],
  imports: [
    NativeScriptModule, 
    NativeScriptHttpClientModule, 
    AppRoutingModule,    
    WebRTCModule    
  ],
  providers: [],
  bootstrap: [AppComponent],
  schemas: [NO_ERRORS_SCHEMA],
})

export class AppModule {}

The main.tns.ts is:

import { platformNativeScriptDynamic } from '@nativescript/angular';

import { AppModule } from '@src/app/app.module';
import { WebRTC } from 'nativescript-webrtc-plugin';
WebRTC.init(); 

platformNativeScriptDynamic().bootstrapModule(AppModule);

The package.json is:

{
  "name": "my-app",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "android": "ns run android --no-hmr",
    "start": "ng serve",
    "build": "ng build --prod",
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "10.2.4",
    "@angular/cdk": "^10.2.7",
    "@angular/cli": "^10.2.1",
    "@angular/common": "10.2.4",
    "@angular/compiler": "10.2.4",
    "@angular/core": "10.2.4",
    "@angular/flex-layout": "^11.0.0-beta.33",
    "@angular/forms": "10.2.4",
    "@angular/http": "7.2.15",
    "@angular/material": "^10.2.7",
    "@angular/platform-browser": "10.2.4",
    "@angular/platform-browser-dynamic": "10.2.4",
    "@angular/router": "10.2.4",
    "@nativescript/angular": "~10.1.0",
    "@nativescript/core": "~7.0.0",
    "@nativescript/schematics": "^11.0.0",
    "@nativescript/theme": "~2.5.0",
    "@ngrx/effects": "^8.6.1",
    "@ngrx/store": "^8.6.1",
    "@ngrx/store-devtools": "^8.6.1",
    "@ngx-translate/core": "^11.0.1",
    "@ngx-translate/http-loader": "^4.0.0",
    "angular-user-idle": "^2.2.4",
    "angular2-cookie": "^1.2.6",
    "bootstrap": "^4.6.0",
    "buffer": "^5.7.1",
    "codelyzer": "^5.2.2",
    "core-js": "^2.6.12",
    "croppie": "^2.6.4",
    "font-awesome": "^4.7.0",
    "jquery": "^3.5.1",
    "js-sha1": "^0.6.0",
    "lodash": "^4.17.20",
    "material-design-icons": "^3.0.1",
    "nativescript-webrtc-plugin": "^2.0.0-alpha.22",
    "nativescript-websockets": "^1.5.6",
    "ng-chat": "2.0.5",
    "ng-pick-datetime": "^7.0.0",
    "ngx-avatar": "^3.7.0",
    "ngx-bootstrap": "^5.6.2",
    "ngx-clipboard": "^12.3.1",
    "ogv": "^1.7.0",
    "opus-recorder": "^6.2.0",
    "protobufjs": "^6.10.2",
    "reflect-metadata": "~0.1.12",
    "rxjs": "6.6.3",
    "rxjs-compat": "^6.6.3",
    "rxjs-tslint": "^0.1.8",
    "semver": "^7.3.4",
    "socket.io-client": "^2.3.0",
    "stream": "0.0.2",
    "timers": "^0.1.1",
    "tslib": "^2.0.0",
    "typescript": "3.9.7",
    "xml2js": "^0.4.23",
    "xmlbuilder": "^13.0.2",
    "zone.js": "~0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.1002.1",
    "@angular/compiler-cli": "10.2.4",
    "@angular/language-service": "10.2.4",
    "@nativescript/android": "7.0.1",
    "@nativescript/tslint-rules": "~0.0.5",
    "@nativescript/webpack": "^4.0.1",
    "@types/croppie": "^2.5.4",
    "@types/jasmine": "^3.6.3",
    "@types/jasminewd2": "^2.0.8",
    "@types/node": "^12.11.1",
    "jasmine-core": "~3.5.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~5.0.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~3.0.2",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "karma-phantomjs-launcher": "^1.0.4",
    "nativescript-set-version": "^0.2.1",
    "node-sass": "^4.14.1",
    "protractor": "~7.0.0",
    "puppeteer": "^1.20.0",
    "susy": "^3.0.6",
    "ts-node": "~8.3.0",
    "tslint": "~6.1.0"
  },
  "prettier": {
    "singleQuote": true
  },
  "main": "main.tns.js"
}

tns --version output is 7.1.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions