ionic-team / ionic-framework

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
https://ionicframework.com
MIT License
51.15k stars 13.5k forks source link

Build failed ionic 2 #11009

Closed IvanLencina closed 7 years ago

IvanLencina commented 7 years ago

Ionic version: (check one with "x") [ ] 1.x [x] 2.x

I'm submitting a ... (check one with "x") [x] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:

After I installed Insomnia plugin If I run: $ionic run android --consolelogs --livereload or $ionic serve --watch

It works well, but when I run: $ionic build android --prod --release

I have this error:

can't resolve module @ionic-native/core from /media/ivan/Cosas importantes/Trabajo/AnimaEdu/animaedu-mobile/node_modules/@ionic-native/status-bar/index.d.ts
[16:53:45]  build prod failed: Cannot read property 'Plugin' of undefined, resolving symbol StatusBar in 
            /media/ivan/Cosas 
            importantes/Trabajo/AnimaEdu/animaedu-mobile/node_modules/@ionic-native/status-bar/index.d.ts

Expected behavior:

Steps to reproduce:

1 - Installed Insomnia plugin. 2 - Have error like "build prod failed: Cannot read property 'Plugin' of undefined, resolving symbol Insomnia"

At that time I had all my native plugins importedfrom 'ionic-native'.

3 - Deleted 'ionic-native' from packaje.json and replaced with"@ionic-native/core": "^3.4.4" 4 - npm i 5 - Refactored my imports to the new providers version. Example:import { InAppPurchase } from '@ionic-native/in-app-purchase'; instead importfrom 'ionic-native'

6 - Updated app-scripts in packaje.json to: "@ionic/app-scripts": "1.1.4" 7 - npm i

8 - Continue the same issue. I can not generate the prod build.

Related code:

packaje.json:

{
  "name": "ionic-hello-world",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@angular/common": "2.2.1",
    "@angular/compiler": "2.2.1",
    "@angular/compiler-cli": "2.2.1",
    "@angular/core": "2.2.1",
    "@angular/forms": "2.2.1",
    "@angular/http": "2.2.1",
    "@angular/platform-browser": "2.2.1",
    "@angular/platform-browser-dynamic": "2.2.1",
    "@angular/platform-server": "2.2.1",
    "@ionic-native/core": "^3.4.4",
    "@ionic-native/facebook": "^3.4.4",
    "@ionic-native/file": "^3.4.4",
    "@ionic-native/in-app-purchase": "^3.4.4",
    "@ionic-native/insomnia": "^3.4.4",
    "@ionic-native/local-notifications": "^3.4.4",
    "@ionic-native/media": "^3.4.4",
    "@ionic-native/network": "^3.4.4",
    "@ionic-native/screenshot": "^3.4.4",
    "@ionic-native/social-sharing": "^3.4.4",
    "@ionic-native/splash-screen": "^3.4.4",
    "@ionic-native/status-bar": "^3.4.4",
    "@ionic/storage": "1.1.7",
    "angular2-fullcalendar": "^1.1.1",
    "angularfire2": "^2.0.0-beta.6-preview",
    "firebase": "^3.6.4",
    "ionic-angular": "^2.1.0",
    "ionicons": "3.0.0",
    "jquery-ui": "^1.12.1",
    "rxjs": "^5.0.1",
    "soundcloud": "^3.1.2",
    "zone.js": "0.6.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "1.1.4",
    "typescript": "2.0.9"
  },
  "cordovaPlugins": [
    "cordova-plugin-whitelist",
    "cordova-plugin-statusbar",
    "cordova-plugin-console",
    "cordova-plugin-device",
    "cordova-plugin-splashscreen",
    "ionic-plugin-keyboard"
  ],
  "cordovaPlatforms": [],
  "description": "Mindfulness: An Ionic project"
}

Other information:

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

Cordova CLI: 6.5.0 
Ionic Framework Version: 2.1.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.1.4
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.4
Node Version: v6.9.1
Xcode version: Not installed
jgw96 commented 7 years ago

This issue was moved to driftyco/ionic-native#1311

ionitron-bot[bot] commented 6 years ago

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.