Ionic 3 error after update

Post your package.json please.

{
  "name": "ionic-hello-world",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "build": "ionic-app-scripts build",
    "watch": "ionic-app-scripts watch",
    "serve:before": "watch",
    "emulate:before": "build",
    "deploy:before": "build",
    "build:before": "build",
    "run:before": "build"
  },
  "dependencies": {
    "@angular/animations": "^4.0.0",
    "@angular/common": "4.1.0",
    "@angular/compiler": "4.1.0",
    "@angular/compiler-cli": "4.1.0",
    "@angular/core": "4.1.0",
    "@angular/forms": "4.1.0",
    "@angular/http": "4.1.0",
    "@angular/platform-browser": "4.1.0",
    "@angular/platform-browser-dynamic": "4.1.0",
    "@ionic-native/app-version": "^3.7.0",
    "@ionic-native/barcode-scanner": "^3.7.0",
    "@ionic-native/camera": "^3.7.0",
    "@ionic-native/core": "^3.7.0",
    "@ionic-native/file": "^3.7.0",
    "@ionic-native/file-opener": "^3.7.0",
    "@ionic-native/geolocation": "^3.7.0",
    "@ionic-native/keyboard": "^3.7.0",
    "@ionic-native/local-notifications": "^3.7.0",
    "@ionic-native/native-page-transitions": "^3.4.4",
    "@ionic-native/native-storage": "^3.7.0",
    "@ionic-native/photo-viewer": "^3.7.0",
    "@ionic-native/splash-screen": "^3.7.0",
    "@ionic-native/status-bar": "3.7.0",
    "@ionic-native/themeable-browser": "^3.7.0",
    "@ionic-native/transfer": "^3.7.0",
    "@ionic/storage": "2.0.1",
    "chart.js": "^2.5.0",
    "ionic-angular": "3.2.0",
    "ionic-native": "^3.5.0",
    "ionicons": "3.0.0",
    "rxjs": "5.1.1",
    "sw-toolbox": "3.6.0",
    "woocommerce-api": "^1.4.2",
    "zone.js": "0.8.10"
  },
  "devDependencies": {
    "@ionic/app-scripts": "1.3.7",
    "@ionic/cli-plugin-cordova": "1.0.0",
    "@ionic/cli-plugin-ionic-angular": "1.0.0",
    "@types/gapi": "^0.0.32",
    "typescript": "~2.2.1"
  },
  "description": "iCarBeansApp: An Ionic project",
  "cordovaPlugins": [
    "cordova-plugin-device",
    "cordova-plugin-console",
    "cordova-plugin-whitelist",
    "cordova-plugin-splashscreen",
    "cordova-plugin-statusbar",
    "ionic-plugin-keyboard"
  ],
  "cordovaPlatforms": []
}

You should only have one of those. Get rid of the second.

i remove “ionic-native”: “^3.5.0”, but the same error to me.

PS F:\ionic2\iCarApp201705081419_v3> ionic cordova build  android --prod
Running app-scripts build: --prod --iscordovaserve --externalIpRequired --nobrowser

[22:55:03]  build prod started ...
[22:55:03]  clean started ...
[22:55:03]  clean finished in 3 ms
[22:55:03]  copy started ...
[22:55:03]  ngc started ...
[22:55:41]  ngc finished in 38.69 s
[22:55:41]  preprocess started ...
[22:55:41]  deeplinks started ...
[22:55:49]  deeplinks finished in 7.25 s
[22:55:49]  optimization started ...
[22:55:49]  copy finished in 46.55 s
Error: ./src/pages/contact/BusinessContactsUpdate.ts
Module build failed: TypeError: Cannot read property 'content' of undefined
    at Object.optimizationLoader (F:\ionic2\iCarApp201705081419_v3\node_modules\_@ionic_app-scripts@1.3.7@@ionic\app-scripts\dist\webpack\optimization-loader-impl.js:14:24)
    at Object.loader (F:\ionic2\iCarApp201705081419_v3\node_modules\_@ionic_app-scripts@1.3.7@@ionic\app-scripts\dist\webpack\optimization-loader.js:5:32)
 @ ./src/app/app.module.js 63:31-81
 @ ./src/app/app.module.ngfactory.js
 @ ./src/app/main.ts

Did you run npm i after removing that line?

1 Like

Ok, I have no idea what this code is doing but are you handling page names as strings here? If so: This will break with --prod as it changes class names etc. Don’t do that.

ok,when i remove the page ,new errors as bellow…

λ ionic cordova build android --prod
Running app-scripts build: --prod --iscordovaserve --externalIpRequired --nobrowser

[11:18:38] build prod started …
[11:18:38] clean started …
[11:18:38] clean finished in 16 ms
[11:18:38] copy started …
[11:18:38] ngc started …
[11:19:08] ngc finished in 29.48 s
[11:19:08] preprocess started …
[11:19:08] deeplinks started …
[11:19:13] deeplinks finished in 5.05 s
[11:19:13] optimization started …
[11:19:14] copy finished in 35.31 s
[11:20:06] optimization finished in 52.67 s
[11:20:06] preprocess finished in 57.72 s
[11:20:06] webpack started …

<— Last few GCs —>

136909 ms: Mark-sweep 1276.6 (1419.2) → 1276.6 (1435.2) MB, 1325.5 / 0.0 ms [allocation failure] [GC in old space requested].
138234 ms: Mark-sweep 1276.6 (1435.2) → 1276.6 (1435.2) MB, 1324.5 / 0.0 ms [allocation failure] [GC in old space requested].
139618 ms: Mark-sweep 1276.6 (1435.2) → 1284.2 (1419.2) MB, 1383.9 / 0.0 ms [last resort gc].
141012 ms: Mark-sweep 1284.2 (1419.2) → 1291.8 (1419.2) MB, 1393.2 / 0.0 ms [last resort gc].

<— JS stacktrace —>

==== JS stack trace =========================================

Security context: 0000027F272CFB49
2: /* anonymous */ [D:\ionic2\mytest\node_modules_enhanced-resolve@3.1.0@enhanced-resolve\lib\ConcordModulesPlugin.js:~19] [pc=000003173103F352] (this=0000010F6398FD69 <a Resolver with map 000001B4E4421BB1>,request=000001D2A03FD949 <an Object with map 0000028A28EEAEE9>,callback=0000004F5DBF8B81 <JS Function (SharedFunctionInfo 000002E38F091D29)>)
3: applyPluginsParallelBailResult1 [D…

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

I have tried add --max-old-space-size
#!/usr/bin/env node --max-old-space-size=4096 ,same as up
and i alse modify package.json

hello? no body has the same error with me,please help…help…help…