nikini / ionic-gallery-modal

Ionic Gallery Modal (to show all your photos)
166 stars 84 forks source link

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

Open itskrsna opened 7 years ago

itskrsna commented 7 years ago

After Running ionic-app-scripts build --prod

while running the app , facing the above error

nikini commented 7 years ago

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

itskrsna commented 7 years ago

No , this how i import it

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

nikini commented 7 years ago

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

itskrsna commented 7 years ago

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 commented 7 years ago

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

nikini commented 7 years ago

Are you using yarn or npm?

itskrsna commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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

itskrsna commented 7 years ago

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 commented 7 years ago

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

itskrsna commented 7 years ago

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

itskrsna commented 7 years ago

@nikini np , you can view the code here:

main.js

nikini commented 7 years ago

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

Yeah, from the compiled file I can't tell

itskrsna commented 7 years ago

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

nikini commented 7 years ago

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 commented 7 years ago

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

itskrsna commented 7 years ago

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

nikini commented 7 years ago

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

itskrsna commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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

itskrsna commented 7 years ago

@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 commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

What changes u are referring ?

Sent from my iPhone

On 15-Jun-2017, at 7:28 PM, feliperoan notifications@github.com wrote:

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? :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

itskrsna commented 7 years ago

@nikini Any update on this ?

djsanj007 commented 6 years ago

@nikini , Same is happening while running build with AOT

Any update on this?

nikini commented 6 years ago

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 commented 6 years ago

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

itskrsna commented 6 years ago

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

itskrsna commented 6 years ago

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

nikini commented 6 years ago

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 commented 6 years ago

@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 commented 6 years ago

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: