Riron / ionic-img-viewer

Ionic 2+ component providing a Twitter inspired experience to visualize pictures.
MIT License
283 stars 118 forks source link

ngc failed: Failed to transpile TypeScript #54

Closed vishaltechreceptives closed 7 years ago

vishaltechreceptives commented 7 years ago

face issue in build prod mode.

ionic2: v2.2.1 ionic-img-viewer: v2.1.0

[13:09:01] typescript: node_modules/ionic-img-viewer/dist/src/image-viewer-transition-gesture.d.ts, line: 6 Type 'any' is not a constructor function type.

   L5:  import { DomController } from 'ionic-angular';
   L6:  export declare class ImageViewerTransitionGesture extends PanGesture {
   L7:      private component;

[13:09:01] ngc failed: Failed to transpile TypeScript [13:09:01] ionic-app-script task: "build" [13:09:01] Error: Failed to transpile TypeScript Error: Failed to transpile TypeScript at /home/erp/Mobile_app/ionic-sales-app/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:70:47

Riron commented 7 years ago

Duplicate of #51 Please use ionic-img-viewer@1.3.4.

Riron commented 7 years ago

As it seems to be a problem many users are facing, I will add it to the README to make il clear for everyone - apparently the peer depencies are not 👍

vishaltechreceptives commented 7 years ago

okay :+1:

but still face problem in version ionic-img-viewer@1.3.4.

Riron commented 7 years ago

Did you clean / re-install your node_modules ? Is it exactly the same error ?

vishaltechreceptives commented 7 years ago

Yes i have tried.

remove node_modules and reinstall it. then also face problem.

Riron commented 7 years ago

So you have ionic@2.2.1 and ionic-img-viewer@1.3.4 ? And still the same problem ? Only on prod mode or dev mode as well ?

sachinmishra007 commented 7 years ago

Hi

@vishaltechreceptives the problem persists if there would any difference between the ionic version. The plugin is absolutely works fine if you are using ionic 2 because it asks for the ionic 2 and @angular 2 dependency. but if you have got the ball rolling out for ionic 3 & angular 4.x then it creates trouble.

In that case I would like you to suggest to follow the below process.

  1. just run the command npm install --save ionic-img-viewer@1.3.4
  2. delete node_modules from your project and then run npm install

I hope this will help you to achieve the objective. cheers

vishaltechreceptives commented 7 years ago

Hi @Riron in prod mode

vishaltechreceptives commented 7 years ago

Hi @sachinmishra007

system information:

Cordova CLI: 6.5.0 Ionic Framework Version: 2.3.0 Ionic CLI Version: 2.2.3 Ionic App Lib Version: 2.2.1 Ionic App Scripts Version: 1.0.0 OS: Linux 4.4 Node Version: v7.9.0

check my version

hexufeng commented 7 years ago

Typescript Error Module '"/Users/HXF/test/HO/node_modules/ionic-angular/index"' has no exported member 'DomController'. node_modules/ionic-img-viewer/dist/src/image-viewer-transition-gesture.d.ts import { Platform } from 'ionic-angular/platform/platform'; import { DomController } from 'ionic-angular'; export declare class ImageViewerTransitionGesture extends PanGesture { Typescript Error Type 'any' is not a constructor function type. node_modules/ionic-img-viewer/dist/src/image-viewer-transition-gesture.d.ts import { DomController } from 'ionic-angular'; export declare class ImageViewerTransitionGesture extends PanGesture { private component;

hexufeng commented 7 years ago
 "dependencies": {
    "@angular/common": "2.1.1",
    "@angular/compiler": "2.1.1",
    "@angular/compiler-cli": "2.1.1",
    "@angular/core": "2.1.1",
    "@angular/forms": "2.1.1",
    "@angular/http": "2.1.1",
    "@angular/platform-browser": "2.1.1",
    "@angular/platform-browser-dynamic": "2.1.1",
    "@angular/platform-server": "2.1.1",
    "@ionic/storage": "1.1.6",
    "ionic-angular": "2.0.0-rc.3",
    "ionic-img-viewer": "1.3.4",
    "ionic-native": "2.2.3",
    "ionicons": "3.0.0",
    "moment": "^2.18.1",
    "rxjs": "5.0.0-beta.12",
    "zone.js": "0.6.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "0.0.45",
    "typescript": "2.0.6"
  }
hexufeng commented 7 years ago

i have the same error. hope to be helped, thanks very much !

vishaltechreceptives commented 7 years ago

Solution For

ionic2: v2.2.1 ionic-img-viewer: v2.1.0

file path : node_modules/ionic-img-viewer/dist/src/image-viewer-transition-gesture.d.ts

Line 3 : import { PanGesture } from 'ionic-angular';

As no imports are available for "ionic-angular/gestures/pan-gesture" and rather it is "ionic-angular/gestures/gesture" or else use simple imports from "ionic-angular"

hexufeng commented 7 years ago

i have solved the problem by changing version of some dependencies in my project to same with this project's. after change that and then run 'ionic serve', in console it will suggest you to change some other dependency's version too. do by the suggestion until no suggestion appear. and then everything will be right!

Riron commented 7 years ago

Yes, as said earlier it's due to versions mismatch. Make sure you have no peer dependencies warnings while you npm install. Glad you sorted it out.

Closing the issue now as it's working as expected.