Ionic 2 cannot find module 'dgram'

WJM

I have installed a template Ionic 2 application and want to add the NPM package bonjour

After installing and including the package in my component like this:

var Bonjour = require('bonjour');
var bonjour = new Bonjour();

The application won't run stating 'cannot find module dgram'

The application has both the bonjour package and bonjour types installed.

The problem

The application can't find the module dgram which is located in the @types/node file. The project is running TS 2.4.2 and should not need any references to the @types, this should be picked up automatically.

What have I tried

I tried including the @types folder anyway in multiple ways, by setting typeroots or types in the ts.config.json file. This didn't change anything.

I tried specifying types :

"types": ["node", "bonjour"]

I tried reinstalling all node modules and clearing the cache

I tried including a reference path in my component above the require statement:

/// <reference path="node_modules/@types/node/index.d.ts" />

var Bonjour = require('bonjour');
var bonjour = new Bonjour();

This all did not help. Any ideas on how to make my application load this module properly?

WJM

The package Bonjour has a DatagramPlugin which require dgram to function properly. In Ionic 2 this package is not available. The solution is to use the Native Zeroconf package as an alternative.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Ionic 2 - Runtime error Cannot find module "."

From Dev

Runtime Error Cannot find module "ionic-native" IONIC 2

From Dev

IONIC 2 - Runtime Error. Cannot find module “ionic-native”

From Dev

Dynamic Environment Variables in Ionic - Cannot find module

From Dev

Cannot find module generated with “Ionic g provider”

From Dev

Cannot find module "ionic-native"

From Dev

Ionic => Runtime error: Cannot find module "."

From Dev

Ionic/Angular Issue Cannot find module './fs'

From Dev

Cannot find Ionic-angular module

From Dev

Error: Cannot find module "angularfire2/database-deprecated" appmodule ionic 3, Angularfire2

From Dev

TS2307: Cannot find module 'ionic/ionic'

From Dev

ionic2 provider "cannot load module"

From Dev

Cannot find module "d3" error is displayed after i upgraded my project from ionic 2 to ionic 3

From Dev

Cannot find Injectable name in Ionic 2

From Dev

Ionic 2: Cannot find name 'SQLite'

From Dev

Error: "Cannot find module" when cloning Ionic 4 component with StencilJS

From Dev

Cannot find module '@ionic-native/power-management/ngx'

From Dev

Ionic Uncaught Error: Cannot find module "." when importing a service provider

From Dev

ionic cordova build android Cannot find module '../pages/Wallet/'

From

Error: Cannot find module '@ionic/app-scripts'

From Dev

Error: Cannot find module "rxjs/operators" in Ionic Angular

From Dev

Ionic3 - Uncaught Error: Cannot find module '.'

From Dev

Ionic 3: Build in “prod” mode: Cannot find module “.”

From Dev

Ionic 3 Angular 4 Cannot find module `jsonwebtoken`

From Dev

Cannot find module 'read' when using ionic start

From Dev

Ionic firestore Cannot find module "@angular/fire/firestore"

From Dev

Cannot find module '@ionic-native/Camera/ngx'

From Dev

Ionic Cordova Build prod: Cannot find module “.” - Typescript version >3

From Dev

Error: Cannot find module 'symbol-observable' in Ionic 4

Related Related

  1. 1

    Ionic 2 - Runtime error Cannot find module "."

  2. 2

    Runtime Error Cannot find module "ionic-native" IONIC 2

  3. 3

    IONIC 2 - Runtime Error. Cannot find module “ionic-native”

  4. 4

    Dynamic Environment Variables in Ionic - Cannot find module

  5. 5

    Cannot find module generated with “Ionic g provider”

  6. 6

    Cannot find module "ionic-native"

  7. 7

    Ionic => Runtime error: Cannot find module "."

  8. 8

    Ionic/Angular Issue Cannot find module './fs'

  9. 9

    Cannot find Ionic-angular module

  10. 10

    Error: Cannot find module "angularfire2/database-deprecated" appmodule ionic 3, Angularfire2

  11. 11

    TS2307: Cannot find module 'ionic/ionic'

  12. 12

    ionic2 provider "cannot load module"

  13. 13

    Cannot find module "d3" error is displayed after i upgraded my project from ionic 2 to ionic 3

  14. 14

    Cannot find Injectable name in Ionic 2

  15. 15

    Ionic 2: Cannot find name 'SQLite'

  16. 16

    Error: "Cannot find module" when cloning Ionic 4 component with StencilJS

  17. 17

    Cannot find module '@ionic-native/power-management/ngx'

  18. 18

    Ionic Uncaught Error: Cannot find module "." when importing a service provider

  19. 19

    ionic cordova build android Cannot find module '../pages/Wallet/'

  20. 20

    Error: Cannot find module '@ionic/app-scripts'

  21. 21

    Error: Cannot find module "rxjs/operators" in Ionic Angular

  22. 22

    Ionic3 - Uncaught Error: Cannot find module '.'

  23. 23

    Ionic 3: Build in “prod” mode: Cannot find module “.”

  24. 24

    Ionic 3 Angular 4 Cannot find module `jsonwebtoken`

  25. 25

    Cannot find module 'read' when using ionic start

  26. 26

    Ionic firestore Cannot find module "@angular/fire/firestore"

  27. 27

    Cannot find module '@ionic-native/Camera/ngx'

  28. 28

    Ionic Cordova Build prod: Cannot find module “.” - Typescript version >3

  29. 29

    Error: Cannot find module 'symbol-observable' in Ionic 4

HotTag

Archive