ionic-gallery-modal icon indicating copy to clipboard operation
ionic-gallery-modal copied to clipboard

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

Open itskrsna opened this issue 7 years ago • 36 comments

After Running ionic-app-scripts build --prod

while running the app , facing the above error

itskrsna avatar Jun 01 '17 09:06 itskrsna

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

nikini avatar Jun 01 '17 10:06 nikini

No , this how i import it

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

itskrsna avatar Jun 01 '17 10:06 itskrsna

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

nikini avatar Jun 01 '17 10:06 nikini

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": {}
    }
  }
}

itskrsna avatar Jun 01 '17 10:06 itskrsna

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

nikini avatar Jun 01 '17 10:06 nikini

Are you using yarn or npm?

nikini avatar Jun 01 '17 10:06 nikini

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 avatar Jun 01 '17 10:06 itskrsna

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.

itskrsna avatar Jun 01 '17 10:06 itskrsna

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

nikini avatar Jun 01 '17 11:06 nikini

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

itskrsna avatar Jun 01 '17 13:06 itskrsna

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

nikini avatar Jun 02 '17 07:06 nikini

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

itskrsna avatar Jun 05 '17 08:06 itskrsna

@nikini np , you can view the code here:

main.js

itskrsna avatar Jun 05 '17 08:06 itskrsna

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

Yeah, from the compiled file I can't tell

nikini avatar Jun 05 '17 09:06 nikini

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

itskrsna avatar Jun 05 '17 09:06 itskrsna

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

nikini avatar Jun 05 '17 09:06 nikini

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

itskrsna avatar Jun 05 '17 09:06 itskrsna

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

itskrsna avatar Jun 05 '17 13:06 itskrsna

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

nikini avatar Jun 05 '17 13:06 nikini

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 ..

itskrsna avatar Jun 05 '17 13:06 itskrsna

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'

darkokostic avatar Jun 06 '17 16:06 darkokostic

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

nikini avatar Jun 08 '17 07:06 nikini

@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 ..

itskrsna avatar Jun 08 '17 07:06 itskrsna

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

nikini avatar Jun 08 '17 07:06 nikini

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 ?

itskrsna avatar Jun 09 '17 05:06 itskrsna

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

feliperoan avatar Jun 15 '17 13:06 feliperoan

What changes u are referring ?

Sent from my iPhone

On 15-Jun-2017, at 7:28 PM, feliperoan [email protected] 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 avatar Jun 15 '17 15:06 itskrsna

@nikini Any update on this ?

itskrsna avatar Jun 24 '17 07:06 itskrsna

@nikini , Same is happening while running build with AOT

Any update on this?

djsanj007 avatar Jul 07 '17 11:07 djsanj007

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 avatar Jul 23 '17 12:07 nikini