Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Cannot find module "ionic-gallery-modal/ionic-gallery-modal" #27

Open
itskrsna opened this issue Jun 1, 2017 · 36 comments
Open
Labels

Comments

@itskrsna
Copy link

itskrsna commented Jun 1, 2017

After Running ionic-app-scripts build --prod

while running the app , facing the above error

@nikini
Copy link
Owner

nikini commented Jun 1, 2017

Why is it "ionic-gallery-modal/ionic-gallery-modal"? Did you import from that?

@itskrsna
Copy link
Author

itskrsna commented Jun 1, 2017

No , this how i import it

import { GalleryModal, ZoomableImage } from 'ionic-gallery-modal';

@nikini
Copy link
Owner

nikini commented Jun 1, 2017

Ok, that looks fine, for the app module I suppose. What about where you use it

@itskrsna
Copy link
Author

itskrsna commented Jun 1, 2017

In the gallery.ts and its file structure is

src ---> pages ---> gallery --> gallery.ts

in gallery.ts i'm calling as follow

import { GalleryModal, ZoomableImage } from 'ionic-gallery-modal';

Interesting thing is this fails only if i run in ionic-app-scripts build --prod mode.

this is my package.json

{
  "name": "xxxx xxxx",
  "author": "",
  "homepage": "",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "ionic:build": "ionic-app-scripts build --prod",
    "ionic:serve": "ionic-app-scripts serve",
    "watch": "ionic-app-scripts watch",
    "minify": "ionic-app-scripts minify",
    "prodbuild": "ionic cordova build android --prod"
  },
  "dependencies": {
    "@angular/common": "2.4.8",
    "@angular/compiler": "2.4.8",
    "@angular/compiler-cli": "2.4.8",
    "@angular/core": "2.4.8",
    "@angular/forms": "2.4.8",
    "@angular/http": "2.4.8",
    "@angular/platform-browser": "2.4.8",
    "@angular/platform-browser-dynamic": "2.4.8",
    "@angular/platform-server": "2.4.8",
    "@ionic-native/code-push": "^3.10.3",
    "@ionic-native/network": "^3.7.0",
    "@ionic-native/onesignal": "^3.6.1",
    "@ionic-native/youtube-video-player": "^3.8.0",
    "@ionic/cli-plugin-cordova": "^1.3.0",
    "@ionic/storage": "2.0.0",
    "code-push": "1.9.0-beta",
    "com.bunkerpalace.cordova.YoutubeVideoPlayer": "https://github.com/Glitchbone/CordovaYoutubeVideoPlayer.git",
    "cordova-plugin-code-push": "1.9.4-beta",
    "cordova-plugin-compat": "1.1.0",
    "cordova-plugin-console": "1.0.5",
    "cordova-plugin-device": "1.1.4",
    "cordova-plugin-dialogs": "1.3.3",
    "cordova-plugin-file": "4.3.3",
    "cordova-plugin-file-transfer": "1.6.3",
    "cordova-plugin-network-information": "~1.3.3",
    "cordova-plugin-splashscreen": "~4.0.1",
    "cordova-plugin-statusbar": "2.2.1",
    "cordova-plugin-streaming": "https://github.com/mradosta/cordova-plugin-streaming.git",
    "cordova-plugin-whitelist": "1.3.1",
    "cordova-plugin-zip": "3.1.0",
    "ionic-angular": "2.2.0",
    "ionic-gallery-modal": "^0.1.1",
    "ionic-native": "2.4.1",
    "ionic-plugin-keyboard": "~2.2.1",
    "ionicons": "3.0.0",
    "ng2-img-fallback": "^0.2.3",
    "onesignal-cordova-plugin": "https://github.com/OneSignal/OneSignal-Cordova-SDK",
    "rxjs": "5.0.1",
    "sw-toolbox": "3.4.0",
    "videogular2": "^5.2.9",
    "zone.js": "0.7.2"
  },
  "devDependencies": {
    "@ionic/app-scripts": "1.1.4",
    "@ionic/cli-plugin-ionic-angular": "1.3.0",
    "@types/core-js": "^0.9.41",
    "angular2-useful-swiper": "^4.0.4",
    "ngx-swiper-wrapper": "^4.0.0",
    "typescript": "2.0.9"
  },
  "description": "Ionic2Tabs: An Ionic project",
  "cordovaPlugins": [
    "cordova-plugin-whitelist",
    "cordova-plugin-console",
    "cordova-plugin-statusbar",
    "cordova-plugin-device",
    "cordova-plugin-splashscreen",
    "ionic-plugin-keyboard",
    "onesignal-cordova-plugin",
    "cordova-plugin-code-push"
  ],
  "cordovaPlatforms": [],
  "cordova": {
    "plugins": {
      "cordova-plugin-console": {},
      "cordova-plugin-device": {},
      "cordova-plugin-network-information": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-streaming": {},
      "cordova-plugin-whitelist": {},
      "ionic-plugin-keyboard": {},
      "onesignal-cordova-plugin": {},
      "code-push": {},
      "com.bunkerpalace.cordova.YoutubeVideoPlayer": {},
      "cordova-plugin-code-push": {},
      "cordova-plugin-compat": {},
      "cordova-plugin-dialogs": {},
      "cordova-plugin-file": {},
      "cordova-plugin-file-transfer": {},
      "cordova-plugin-zip": {}
    }
  }
}

@nikini
Copy link
Owner

nikini commented Jun 1, 2017

That is weird. Did you try searching within your project for ionic-gallery-modal/ionic-gallery-modal? Maybe accidentally it's somewhere..

@nikini
Copy link
Owner

nikini commented Jun 1, 2017

Are you using yarn or npm?

@itskrsna
Copy link
Author

itskrsna commented Jun 1, 2017

Yes , i do search there but i didn't find anything like that , i removed the package and added back again using npm from your readme , but still no luck..

@itskrsna
Copy link
Author

itskrsna commented Jun 1, 2017

Just to add more info , i didn't get any compile error as i have tried with --verbose also . only when running the app i got this error.

@nikini
Copy link
Owner

nikini commented Jun 1, 2017

Does it say where the error is? Like the file/line?

@itskrsna
Copy link
Author

itskrsna commented Jun 1, 2017

This is the Console Error

Uncaught Error: Cannot find module "ionic-gallery-modal/ionic-gallery-modal"
    at v (polyfills.js:3)
    at Object.<anonymous> (main.js:42)
    at e (main.js:1)
    at Object.<anonymous> (main.js:35)
    at e (main.js:1)
    at Object.<anonymous> (main.js:62)
    at e (main.js:1)
    at main.js:1
    at main.js:1

@nikini
Copy link
Owner

nikini commented Jun 2, 2017

Hmm, could you send me the main js compiled file? I don't think I can trace the error otherwise

@itskrsna
Copy link
Author

itskrsna commented Jun 5, 2017

Can you provide me ur mail id , so that i can mail u , rather than posting whole file here?

@itskrsna
Copy link
Author

itskrsna commented Jun 5, 2017

@nikini np , you can view the code here:

main.js

@nikini
Copy link
Owner

nikini commented Jun 5, 2017

You can see my email address in my profile. :)

Yeah, from the compiled file I can't tell

@itskrsna
Copy link
Author

itskrsna commented Jun 5, 2017

@nikini , if it is uncompiled , im not getting this issue.. event then you need that uncompiled file ?

@nikini
Copy link
Owner

nikini commented Jun 5, 2017

Hmm, let's try it differently. Can you clone the demo and try to compile it? I'm curious if that is working for you

@itskrsna
Copy link
Author

itskrsna commented Jun 5, 2017

Sure , let me give a try and get back to u

@itskrsna
Copy link
Author

itskrsna commented Jun 5, 2017

@nikini even with your demo after upgrading to the 0.1.1 , i'm able to repro the issue..

@nikini
Copy link
Owner

nikini commented Jun 5, 2017

What's the command you ran on my demo? I can also try to run it

@itskrsna
Copy link
Author

itskrsna commented Jun 5, 2017

Sure , here is the package.json of your modified demo

{
    "name": "ionic-gallery-modal-demo",
    "author": "Ciprian Mocanu",
    "homepage": "http://mbe.ro/",
    "private": true,
    "scripts": {
        "clean": "ionic-app-scripts clean",
        "build": "ionic-app-scripts build",
        "ionic:build": "ionic-app-scripts build --prod",
        "ionic:serve": "ionic-app-scripts serve"
    },
  "dependencies": {

    "@angular/common": "2.4.8",
    "@angular/compiler": "2.4.8",
    "@angular/compiler-cli": "2.4.8",
    "@angular/core": "2.4.8",
    "@angular/forms": "2.4.8",
    "@angular/http": "2.4.8",
    "@angular/platform-browser": "2.4.8",
    "@angular/platform-browser-dynamic": "2.4.8",
    "@angular/platform-server": "2.4.8",
    "@ionic-native/code-push": "^3.10.3",
    "@ionic-native/network": "^3.7.0",
    "@ionic-native/onesignal": "^3.6.1",
    "@ionic-native/youtube-video-player": "^3.8.0",
    "@ionic/cli-plugin-cordova": "^1.3.0",
    "@ionic/storage": "2.0.0",


    "@ionic-native/core": "3.6.1",
    "@ionic-native/splash-screen": "^3.6.1",
    "@ionic-native/status-bar": "^3.6.1",
    "ionic-angular": "2.2.0",
    "ionic-gallery-modal": "^0.1.1",
    "ionic-native": "2.4.1",
    "ionicons": "3.0.0",  
    "rxjs": "5.0.1",
    "sw-toolbox": "3.4.0",
    "zone.js": "0.7.2",
    "cordova-plugin-console": "1.0.5",
    "cordova-plugin-device": "1.1.4",
    "cordova-plugin-splashscreen": "~4.0.1",
    "cordova-plugin-statusbar": "2.2.1",
    "cordova-plugin-whitelist": "1.3.1",
    "ionic-plugin-keyboard": "~2.2.1"
  },
  "devDependencies": {
   
    "@ionic/cli-plugin-cordova": "1.2.1",
    "@ionic/app-scripts": "1.1.4",
    "@ionic/cli-plugin-ionic-angular": "1.3.0", 
    "typescript": "2.0.9"
  },
    "cordovaPlugins": [
        "cordova-plugin-whitelist",
        "cordova-plugin-console",
        "cordova-plugin-statusbar",
        "cordova-plugin-device",
        "cordova-plugin-splashscreen",
        "ionic-plugin-keyboard"
    ],
    "cordovaPlatforms": [
        "ios",
        {
            "platform": "ios",
            "version": "",
            "locator": "ios"
        }
    ],
    "description": "ionic-gallery-modal-demo: A demo for the Ionig Gallery Modal",
    "cordova": {
        "plugins": {
            "cordova-plugin-console": {},
            "cordova-plugin-device": {},
            "cordova-plugin-splashscreen": {},
            "cordova-plugin-statusbar": {},
            "cordova-plugin-whitelist": {},
            "ionic-plugin-keyboard": {}
        }
    }
}

In the above i added ionic-build in Prod mode , so i ran that one ..

@darkokostic
Copy link

Hi there, I had the same issue, after that I removed my node_modules and run npm install to install it again. I am now getting this error when I run ionic build android --prod:

ionic-app-script task: "build"
[18:20:15] Error: ./~/ionic-gallery-modal/ionic-gallery-modal.ngfactory.js Module not found: Error: Can't resolve 'ionic-gallery-modal/ionic-gallery-modal'

@nikini
Copy link
Owner

nikini commented Jun 8, 2017

I'll be releasing a new feature in a couple of days that will address this issue (beside others)

@nikini nikini added the bug label Jun 8, 2017
@itskrsna
Copy link
Author

itskrsna commented Jun 8, 2017

@nikini sure, can you tell me what might be the cause of it ?

Thanks for the Quick Response and Support .. any help for the Repo i'm there ..

@nikini
Copy link
Owner

nikini commented Jun 8, 2017

Well, like most issues, I think it's the transpiling. But, I've made a module out of it and then, you will only need to import the module. I think that that will fix it. I'll have to test.
Haven't really tested it yet, just assuming that that might be it

@itskrsna
Copy link
Author

itskrsna commented Jun 9, 2017

That seems to be interesting one to discuss .. generally transpiling will be taken care by ionic-app-scripts . aren't you using them ? or am i missing something here ?

@feliperoan
Copy link

Is a simple plugin and what many need, but I would like to know if you made any changes about the error when compiling --prod? :)

@itskrsna
Copy link
Author

itskrsna commented Jun 15, 2017 via email

@itskrsna
Copy link
Author

@nikini Any update on this ?

@djsanj007
Copy link

@nikini , Same is happening while running build with AOT

Any update on this?

@nikini
Copy link
Owner

nikini commented Jul 23, 2017

Hello, sorry for the delay. Please check v0.2.1. But, also check on how to use it. It's slightly different now, since it has its own module

@nikini
Copy link
Owner

nikini commented Jul 31, 2017

I'll close this issue in 7 days and assume it's fixed :)

@itskrsna
Copy link
Author

itskrsna commented Jul 31, 2017

@nikini i moved to another project , will take time and will check this issue and update u within 2 days .. thanks for this :)

@itskrsna
Copy link
Author

@nikini started working on this . .. will update the Status

@nikini
Copy link
Owner

nikini commented Aug 12, 2017

Just make sure you use the latest version, and make sure you include the library with the module as it says in the README, please

@itskrsna
Copy link
Author

itskrsna commented Aug 18, 2017

@nikini i have tried with the new Changes , in my app using the lazy-load when i tried to load the modal it is throwing error as Cannot read property '_getPortal' of undefined

Update: :
I'm unable to re-pro this issue when i'm trying without lazy loading components . Issue occurs only when trying with the Lazy Loading.

@SanSolo
Copy link

SanSolo commented Oct 18, 2017

Hi,

Still having the issue "ionic-gallery-modal module not found" with v.0.2.7. I'm following the new way to use it but still having trouble.

In my app.module.ts:
image

My package.json file:

"dependencies": {
"@angular/common": "4.4.3",
"@angular/compiler": "4.4.3",
"@angular/compiler-cli": "4.4.3",
"@angular/core": "4.4.3",
"@angular/forms": "4.4.3",
"@angular/http": "4.4.3",
"@angular/platform-browser": "4.4.3",
"@angular/platform-browser-dynamic": "4.4.3",
"@ionic-native/camera": "^3.13.0",
"@ionic-native/core": "^3.10.2",
"@ionic-native/splash-screen": "^3.10.2",
"@ionic-native/status-bar": "^3.10.2",
"@ionic/storage": "^2.0.1",
"angular2-signaturepad": "^2.6.0",
"cordova-android": "^6.2.3",
"cordova-ios": "^4.4.0",
"cordova-plugin-camera": "^2.4.1",
"cordova-plugin-compat": "^1.1.0",
"cordova-plugin-console": "^1.0.7",
"cordova-plugin-device": "^1.1.6",
"cordova-plugin-splashscreen": "^4.0.3",
"cordova-plugin-statusbar": "^2.2.3",
"cordova-plugin-whitelist": "^1.3.2",
"crypto-js": "^3.1.9-1",
"ionic-angular": "3.7.1",
"ionic-gallery-modal": "0.2.7",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "^3.0.0",
"rxjs": "^5.4.0",
"sw-toolbox": "^3.6.0",
"zone.js": "^0.8.12"
},
"devDependencies": {
"@ionic/app-scripts": "^1.3.7",
"ionic": "3.13.1",
"typescript": "^2.3.3"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-camera": {
"CAMERA_USAGE_DESCRIPTION": " ",
"PHOTOLIBRARY_USAGE_DESCRIPTION": " "
},
"cordova-plugin-console": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-whitelist": {},
"ionic-plugin-keyboard": {}
},
"platforms": [
"android",
"ios"
]
}
}

Any idea on what's going on there ?

UPDATE:

Fixed it with:

  • Deleted node_modules folder
  • npm cache clear
  • npm install

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants