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

KnowledgeSeeker

I am trying to import a new service provider that I just created after pulling from the latest branch in my ionic app.

When I try to import this line of code:

import { AuthServiceProvider } from '../providers/auth-service'

in app.module.ts I always got an error saying that:

Uncaught Error: Cannot find module "."
    at webpackMissingModule (index.js:3)
    at e.code (index.js:3)
    at Object.<anonymous> (index.js:9)
    at __webpack_require__ (bootstrap 62d6a5897825ac327001:54)
    at Object.690 (slide.transition.ts:67)
    at __webpack_require__ (bootstrap 62d6a5897825ac327001:54)
    at Object.495 (main.js:1885)
    at __webpack_require__ (bootstrap 62d6a5897825ac327001:54)
    at Object.487 (notification-api.ts:6)
    at __webpack_require__ (bootstrap 62d6a5897825ac327001:54)

But take note that I am also importing another service from my provider that is working perfectly.

Here is the code of my auth-service.ts below.

import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Events } from 'ionic-angular/umd';

/*
  Generated class for the AuthServiceProvider provider.

  See https://angular.io/guide/dependency-injection for more info on providers
  and Angular DI.
*/
@Injectable()
export class AuthServiceProvider {

  public isLoggedIn = false;

  constructor(
    public http: HttpClient,
    private events: Events
  ) {
    console.log('Hello AuthServiceProvider Provider');

    events.subscribe('user:logged-in', (user) => {
      this.isLoggedIn = true;
      console.log('Welcome', user);
    });
  }

}

I won't show my code in my app.module.ts because it is bombarded by import plugins and other providers.

Here is my ionic info

cli packages: (/usr/lib/node_modules)

@ionic/cli-utils  : 1.19.2
ionic (Ionic CLI) : 3.20.0

global packages:

cordova (Cordova CLI) : 8.0.0 

local packages:

@ionic/app-scripts : 3.1.8
Cordova Platforms  : android 6.3.0 browser 5.0.3
Ionic Framework    : ionic-angular 3.9.2

System:

Android SDK Tools : 26.1.1
Node              : v6.12.2
npm               : 4.6.1 
OS                : Linux 4.13

Environment Variables:

ANDROID_HOME : /home/clifford/Android/Sdk

So why I am having an error in that specific service provider compare to other providers which are just the same?

Any thoughts?

Appreciate if someone could help. Thanks in advance.

KnowledgeSeeker

I finally figure it out to solve the problem. The error occurs when I import the events from ionic-angular.

So instead of: import { Events } from 'ionic-angular/umd';

Just remove the umd at the end. I don't know why it happened because I am using auto import from my vs code.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How can I resolve Ionic Uncaught Error: Cannot find module "." when adding new page?

From Dev

Ionic3 - Uncaught Error: Cannot find module '.'

From Dev

Cannot find module error when importing a module with exported enums

From Dev

"Cannot find module" error when importing mp3

From Dev

Error "Cannot find module" when importing a remote JSON file in TypeScript

From Dev

Cannot find module generated with “Ionic g provider”

From Dev

Uncaught Error: Cannot Find Module When Using Dynamic Import for JavaScript

From Dev

Uncaught Error: Cannot find module "fs" when using webpack

From Dev

Ionic 4 / Angular Routing: ERROR Error: Uncaught (in promise): Error: Cannot find 'EventHomePageModule' in './home/home.module'

From Dev

' Cannot find module './admin.service' when importing the admin.service.ts file in angular?

From Dev

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

From Dev

Uncaught Error: Cannot find module "./RandomWords"

From Dev

Uncaught Error: Cannot find module 'stream'

From Dev

Uncaught Error: Cannot find module 'redux'

From Dev

Uncaught Error: Cannot find module 'openpgp'

From Dev

Uncaught Error: Cannot find module 'firebase'

From Dev

Why I get "Uncaught Error: Cannot find module 'multi.js' " when module is installed globally?

From Dev

Ionic 2 - Runtime error Cannot find module "."

From Dev

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

From Dev

'Cannot find module fingerprintjs2' error when importing the library in Angular project

From Dev

Uncaught Error: Cannot find module 'firebase' when trying to use serverTimestamp in firestore

From Dev

Meteor Error: Uncaught Error: Cannot find module 'component.jsx'

From Dev

Console error "Uncaught Error: Cannot find module "/axios" at webpackMissingModule" with react

From Dev

Dynamic import components error - Uncaught (in promise) Error: Cannot find module

From Dev

Error when importing a module

From

Jest gives `Cannot find module` when importing components with absolute paths

From Dev

"Cannot find module" when importing .csv file in Create React App

From Dev

Cannot find module when importing from project in python

From Dev

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

Related Related

  1. 1

    How can I resolve Ionic Uncaught Error: Cannot find module "." when adding new page?

  2. 2

    Ionic3 - Uncaught Error: Cannot find module '.'

  3. 3

    Cannot find module error when importing a module with exported enums

  4. 4

    "Cannot find module" error when importing mp3

  5. 5

    Error "Cannot find module" when importing a remote JSON file in TypeScript

  6. 6

    Cannot find module generated with “Ionic g provider”

  7. 7

    Uncaught Error: Cannot Find Module When Using Dynamic Import for JavaScript

  8. 8

    Uncaught Error: Cannot find module "fs" when using webpack

  9. 9

    Ionic 4 / Angular Routing: ERROR Error: Uncaught (in promise): Error: Cannot find 'EventHomePageModule' in './home/home.module'

  10. 10

    ' Cannot find module './admin.service' when importing the admin.service.ts file in angular?

  11. 11

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

  12. 12

    Uncaught Error: Cannot find module "./RandomWords"

  13. 13

    Uncaught Error: Cannot find module 'stream'

  14. 14

    Uncaught Error: Cannot find module 'redux'

  15. 15

    Uncaught Error: Cannot find module 'openpgp'

  16. 16

    Uncaught Error: Cannot find module 'firebase'

  17. 17

    Why I get "Uncaught Error: Cannot find module 'multi.js' " when module is installed globally?

  18. 18

    Ionic 2 - Runtime error Cannot find module "."

  19. 19

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

  20. 20

    'Cannot find module fingerprintjs2' error when importing the library in Angular project

  21. 21

    Uncaught Error: Cannot find module 'firebase' when trying to use serverTimestamp in firestore

  22. 22

    Meteor Error: Uncaught Error: Cannot find module 'component.jsx'

  23. 23

    Console error "Uncaught Error: Cannot find module "/axios" at webpackMissingModule" with react

  24. 24

    Dynamic import components error - Uncaught (in promise) Error: Cannot find module

  25. 25

    Error when importing a module

  26. 26

    Jest gives `Cannot find module` when importing components with absolute paths

  27. 27

    "Cannot find module" when importing .csv file in Create React App

  28. 28

    Cannot find module when importing from project in python

  29. 29

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

HotTag

Archive