How to build browser version in Ionic 4

Hello,

How to build browser version using Ionic 4. When I tried to build using ionic cordova build browser --prod and uploaded platforms/browser/www files on server and tried to run in browser it’s not showing anything(webpage is blank).

Can anyone please help me on the same?

1 Like

ionic build should be enough if you are not using any native Cordova plugins.

Ionic does not really support the Cordova browser platform, and most plugins also don’t support the browser platform or only rudimentary.

That said, you should be able to look at your browser’s dev tools to find out what the problem is. Try without --prod first maybe for better debugging.

I have tried with ionic build browser without --prod but getting same error in devtools as mentioned below.

Show us the output of the build command with --verbose added at the end please.

Please find below output of ionic build browser --verbose

  ionic:cli-utils Terminal info: { tty: true, ci: false } +0ms
  ionic:cli-utils CLI global options: { _: [ 'build', 'browser' ], help: null, h: null, verbose: true, quiet: null, interactive: true, color: true, confirm: null, json: null, project: null, '--': [] } +0ms
  ionic:cli-utils:lib:project Project type from config: ionic/angular 4 (angular) +0ms
  ionic:cli-utils Project name: undefined +12s
  ionic:cli Context: { binPath: 'C:\\Users\\test\\AppData\\Roaming\\npm\\node_modules\\ionic\\bin\\ionic', libPath: 'C:\\Users\\test\\AppData\\Roaming\\npm\\node_modules\\ionic', execPath: 'D:\\test\\Ionic\\Ionic4_proj\\myAppLatest', version: '4.1.1' }
+0ms
[WARN] ionic build is for building web assets and takes no arguments. See ionic build --help.

       Ignoring argument browser. Perhaps you meant ionic cordova build browser?

  ionic:cli-utils:lib:hooks Looking for ionic:build:before npm script. +0ms
  ionic:cli-utils:lib:build Looking for ionic:build npm script. +0ms
> ng run app:build

Date: 2018-09-03T09:49:07.865Z
Hash: d9751bc45b0bc752e0be
Time: 26123ms
chunk {common} common.js, common.js.map (common) 8.55 kB  [rendered]
chunk {main} main.js, main.js.map (main) 12.9 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 226 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 8.02 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 36.1 kB [initial] [rendered]
chunk {tabs-tabs-module} tabs-tabs-module.js, tabs-tabs-module.js.map (tabs-tabs-module) 26.7 kB  [rendered]
chunk {129} 129.js, 129.js.map () 14.9 kB  [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 3.91 MB [initial] [rendered]
chunk {0} 0.js, 0.js.map () 46 kB  [rendered]
chunk {1} 1.js, 1.js.map () 43.6 kB  [rendered]
chunk {2} 2.js, 2.js.map () 45.6 kB  [rendered]
chunk {3} 3.js, 3.js.map () 43.4 kB  [rendered]
chunk {4} 4.js, 4.js.map () 1.74 kB  [rendered]
chunk {5} 5.js, 5.js.map () 1.69 kB  [rendered]
chunk {6} 6.js, 6.js.map () 209 kB  [rendered]
chunk {7} 7.js, 7.js.map () 204 kB  [rendered]
chunk {8} 8.js, 8.js.map () 209 kB  [rendered]
chunk {9} 9.js, 9.js.map () 204 kB  [rendered]
chunk {10} 10.js, 10.js.map () 13.5 kB  [rendered]
chunk {11} 11.js, 11.js.map () 12.3 kB  [rendered]
chunk {12} 12.js, 12.js.map () 12.5 kB  [rendered]
chunk {13} 13.js, 13.js.map () 9.23 kB  [rendered]
chunk {14} 14.js, 14.js.map () 9.11 kB  [rendered]
chunk {15} 15.js, 15.js.map () 9.22 kB  [rendered]
chunk {16} 16.js, 16.js.map () 9.1 kB  [rendered]
chunk {17} 17.js, 17.js.map () 11.4 kB  [rendered]
chunk {18} 18.js, 18.js.map () 11.1 kB  [rendered]
chunk {19} 19.js, 19.js.map () 11.4 kB  [rendered]
chunk {20} 20.js, 20.js.map () 11.2 kB  [rendered]
chunk {21} 21.js, 21.js.map () 3.52 kB  [rendered]
chunk {22} 22.js, 22.js.map () 3.44 kB  [rendered]
chunk {23} 23.js, 23.js.map () 3.51 kB  [rendered]
chunk {24} 24.js, 24.js.map () 3.43 kB  [rendered]
chunk {25} 25.js, 25.js.map () 20.2 kB  [rendered]
chunk {26} 26.js, 26.js.map () 19.5 kB  [rendered]
chunk {27} 27.js, 27.js.map () 19.9 kB  [rendered]
chunk {28} 28.js, 28.js.map () 19.3 kB  [rendered]
chunk {29} 29.js, 29.js.map () 14.1 kB  [rendered]
chunk {30} 30.js, 30.js.map () 14 kB  [rendered]
chunk {31} 31.js, 31.js.map () 9.68 kB  [rendered]
chunk {32} 32.js, 32.js.map () 9.55 kB  [rendered]
chunk {33} 33.js, 33.js.map () 9.39 kB  [rendered]
chunk {34} 34.js, 34.js.map () 9.28 kB  [rendered]
chunk {35} 35.js, 35.js.map () 11.3 kB  [rendered]
chunk {36} 36.js, 36.js.map () 11.1 kB  [rendered]
chunk {37} 37.js, 37.js.map () 11.4 kB  [rendered]
chunk {38} 38.js, 38.js.map () 11.2 kB  [rendered]
chunk {39} 39.js, 39.js.map () 10.7 kB  [rendered]
chunk {40} 40.js, 40.js.map () 10.5 kB  [rendered]
chunk {41} 41.js, 41.js.map () 7.25 kB  [rendered]
chunk {42} 42.js, 42.js.map () 7.08 kB  [rendered]
chunk {43} 43.js, 43.js.map () 35.8 kB  [rendered]
chunk {44} 44.js, 44.js.map () 35.7 kB  [rendered]
chunk {45} 45.js, 45.js.map () 17.4 kB  [rendered]
chunk {46} 46.js, 46.js.map () 16.7 kB  [rendered]
chunk {47} 47.js, 47.js.map () 17.3 kB  [rendered]
chunk {48} 48.js, 48.js.map () 16.7 kB  [rendered]
chunk {49} 49.js, 49.js.map () 4.56 kB  [rendered]
chunk {50} 50.js, 50.js.map () 2.48 kB  [rendered]
chunk {51} 51.js, 51.js.map () 2.45 kB  [rendered]
chunk {52} 52.js, 52.js.map () 12.7 kB  [rendered]
chunk {53} 53.js, 53.js.map () 12.7 kB  [rendered]
chunk {54} 54.js, 54.js.map () 15.6 kB  [rendered]
chunk {55} 55.js, 55.js.map () 15.2 kB  [rendered]
chunk {56} 56.js, 56.js.map () 15.5 kB  [rendered]
chunk {57} 57.js, 57.js.map () 15.1 kB  [rendered]
chunk {58} 58.js, 58.js.map () 24.5 kB  [rendered]
chunk {59} 59.js, 59.js.map () 23.2 kB  [rendered]
chunk {60} 60.js, 60.js.map () 24.7 kB  [rendered]
chunk {61} 61.js, 61.js.map () 23.5 kB  [rendered]
chunk {62} 62.js, 62.js.map () 11 kB  [rendered]
chunk {63} 63.js, 63.js.map () 10.9 kB  [rendered]
chunk {64} 64.js, 64.js.map () 15.6 kB  [rendered]
chunk {65} 65.js, 65.js.map () 15.4 kB  [rendered]
chunk {66} 66.js, 66.js.map () 18.6 kB  [rendered]
chunk {67} 67.js, 67.js.map () 18.1 kB  [rendered]
chunk {68} 68.js, 68.js.map () 18.5 kB  [rendered]
chunk {69} 69.js, 69.js.map () 18.1 kB  [rendered]
chunk {70} 70.js, 70.js.map () 11.2 kB  [rendered]
chunk {71} 71.js, 71.js.map () 11.3 kB  [rendered]
chunk {72} 72.js, 72.js.map () 2.8 kB  [rendered]
chunk {73} 73.js, 73.js.map () 14.1 kB  [rendered]
chunk {74} 74.js, 74.js.map () 13.6 kB  [rendered]
chunk {75} 75.js, 75.js.map () 2.93 kB  [rendered]
chunk {76} 76.js, 76.js.map () 19.4 kB  [rendered]
chunk {77} 77.js, 77.js.map () 19 kB  [rendered]
chunk {78} 78.js, 78.js.map () 21.1 kB  [rendered]
chunk {79} 79.js, 79.js.map () 20.5 kB  [rendered]
chunk {80} 80.js, 80.js.map () 15.7 kB  [rendered]
chunk {81} 81.js, 81.js.map () 15.6 kB  [rendered]
chunk {82} 82.js, 82.js.map () 7.73 kB  [rendered]
chunk {83} 83.js, 83.js.map () 2.9 kB  [rendered]
chunk {84} 84.js, 84.js.map () 2.85 kB  [rendered]
chunk {85} 85.js, 85.js.map () 14.9 kB  [rendered]
chunk {86} 86.js, 86.js.map () 18.3 kB  [rendered]
chunk {87} 87.js, 87.js.map () 16.9 kB  [rendered]
chunk {88} 88.js, 88.js.map () 16.7 kB  [rendered]
chunk {89} 89.js, 89.js.map () 16.1 kB  [rendered]
chunk {90} 90.js, 90.js.map () 14 kB  [rendered]
chunk {91} 91.js, 91.js.map () 13.5 kB  [rendered]
chunk {92} 92.js, 92.js.map () 13.3 kB  [rendered]
chunk {93} 93.js, 93.js.map () 13 kB  [rendered]
chunk {94} 94.js, 94.js.map () 9.05 kB  [rendered]
chunk {95} 95.js, 95.js.map () 1.6 kB  [rendered]
chunk {96} 96.js, 96.js.map () 11.4 kB  [rendered]
chunk {97} 97.js, 97.js.map () 11.1 kB  [rendered]
chunk {98} 98.js, 98.js.map () 9.7 kB  [rendered]
chunk {99} 99.js, 99.js.map () 9.71 kB  [rendered]
chunk {100} 100.js, 100.js.map () 27.4 kB  [rendered]
chunk {101} 101.js, 101.js.map () 26.1 kB  [rendered]
chunk {102} 102.js, 102.js.map () 27.8 kB  [rendered]
chunk {103} 103.js, 103.js.map () 26.7 kB  [rendered]
chunk {104} 104.js, 104.js.map () 6.59 kB  [rendered]
chunk {105} 105.js, 105.js.map () 6.57 kB  [rendered]
chunk {106} 106.js, 106.js.map () 12.7 kB  [rendered]
chunk {107} 107.js, 107.js.map () 12.5 kB  [rendered]
chunk {108} 108.js, 108.js.map () 12.7 kB  [rendered]
chunk {109} 109.js, 109.js.map () 12.5 kB  [rendered]
chunk {110} 110.js, 110.js.map () 15.5 kB  [rendered]
chunk {111} 111.js, 111.js.map () 15.4 kB  [rendered]
chunk {112} 112.js, 112.js.map () 15.9 kB  [rendered]
chunk {113} 113.js, 113.js.map () 15.4 kB  [rendered]
chunk {114} 114.js, 114.js.map () 14.8 kB  [rendered]
chunk {115} 115.js, 115.js.map () 14.5 kB  [rendered]
chunk {116} 116.js, 116.js.map () 11.5 kB  [rendered]
chunk {117} 117.js, 117.js.map () 14.7 kB  [rendered]
chunk {118} 118.js, 118.js.map () 1.28 kB  [rendered]
chunk {119} 119.js, 119.js.map () 2.36 kB  [rendered]
chunk {120} 120.js, 120.js.map () 1.39 kB  [rendered]
chunk {121} 121.js, 121.js.map () 8.11 kB  [rendered]
chunk {122} 122.js, 122.js.map () 5.15 kB  [rendered]
chunk {123} 123.js, 123.js.map () 9.87 kB  [rendered]
chunk {124} 124.js, 124.js.map () 4.67 kB  [rendered]
chunk {125} 125.js, 125.js.map () 1.8 kB  [rendered]
chunk {126} 126.js, 126.js.map () 1.03 kB  [rendered]
chunk {127} 127.js, 127.js.map () 3.49 kB  [rendered]
chunk {128} 128.js, 128.js.map () 7.29 kB  [rendered]
  ionic:cli-utils:lib:hooks Looking for ionic:build:after npm script. +2m

Oh, I missed that:
If you want to build the Cordova platform browser, the command is ionic cordova build browser.
If you want to build Ionic plain app (which is just a web app), the command is ionic build.

1 Like

I have tried with ionic build command also but getting same error in devtools.
Below is the output of ionic build --verbose

  ionic:cli-utils Terminal info: { tty: true, ci: false } +0ms
  ionic:cli-utils CLI global options: { _: [ 'build' ], help: null, h: null, verbose: true, quiet: null, interactive: true, color: true, confirm: null, json: null, project: null, '--': [] } +0ms
  ionic:cli-utils:lib:project Project type from config: ionic/angular 4 (angular) +0ms
  ionic:cli-utils Project name: undefined +287ms
  ionic:cli Context: { binPath: 'C:\\Users\\test\\AppData\\Roaming\\npm\\node_modules\\ionic\\bin\\ionic', libPath: 'C:\\Users\\test\\AppData\\Roaming\\npm\\node_modules\\ionic', execPath: 'D:\\test\\Ionic\\Ionic4_projs\\myAppLatest', version: '4.1.1' }
+0ms
  ionic:cli-utils:lib:hooks Looking for ionic:build:before npm script. +0ms
  ionic:cli-utils:lib:build Looking for ionic:build npm script. +0ms
> ng run app:build

Date: 2018-09-03T10:40:26.381Z
Hash: d9751bc45b0bc752e0be
Time: 17899ms
chunk {common} common.js, common.js.map (common) 8.55 kB  [rendered]
chunk {main} main.js, main.js.map (main) 12.9 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 226 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 8.02 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 36.1 kB [initial] [rendered]
chunk {tabs-tabs-module} tabs-tabs-module.js, tabs-tabs-module.js.map (tabs-tabs-module) 26.7 kB  [rendered]
chunk {129} 129.js, 129.js.map () 14.9 kB  [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 3.91 MB [initial] [rendered]
chunk {0} 0.js, 0.js.map () 46 kB  [rendered]
chunk {1} 1.js, 1.js.map () 43.6 kB  [rendered]
chunk {2} 2.js, 2.js.map () 45.6 kB  [rendered]
chunk {3} 3.js, 3.js.map () 43.4 kB  [rendered]
chunk {4} 4.js, 4.js.map () 1.74 kB  [rendered]
chunk {5} 5.js, 5.js.map () 1.69 kB  [rendered]
chunk {6} 6.js, 6.js.map () 209 kB  [rendered]
chunk {7} 7.js, 7.js.map () 204 kB  [rendered]
chunk {8} 8.js, 8.js.map () 209 kB  [rendered]
chunk {9} 9.js, 9.js.map () 204 kB  [rendered]
chunk {10} 10.js, 10.js.map () 13.5 kB  [rendered]
chunk {11} 11.js, 11.js.map () 12.3 kB  [rendered]
chunk {12} 12.js, 12.js.map () 12.5 kB  [rendered]
chunk {13} 13.js, 13.js.map () 9.23 kB  [rendered]
chunk {14} 14.js, 14.js.map () 9.11 kB  [rendered]
chunk {15} 15.js, 15.js.map () 9.22 kB  [rendered]
chunk {16} 16.js, 16.js.map () 9.1 kB  [rendered]
chunk {17} 17.js, 17.js.map () 11.4 kB  [rendered]
chunk {18} 18.js, 18.js.map () 11.1 kB  [rendered]
chunk {19} 19.js, 19.js.map () 11.4 kB  [rendered]
chunk {20} 20.js, 20.js.map () 11.2 kB  [rendered]
chunk {21} 21.js, 21.js.map () 3.52 kB  [rendered]
chunk {22} 22.js, 22.js.map () 3.44 kB  [rendered]
chunk {23} 23.js, 23.js.map () 3.51 kB  [rendered]
chunk {24} 24.js, 24.js.map () 3.43 kB  [rendered]
chunk {25} 25.js, 25.js.map () 20.2 kB  [rendered]
chunk {26} 26.js, 26.js.map () 19.5 kB  [rendered]
chunk {27} 27.js, 27.js.map () 19.9 kB  [rendered]
chunk {28} 28.js, 28.js.map () 19.3 kB  [rendered]
chunk {29} 29.js, 29.js.map () 14.1 kB  [rendered]
chunk {30} 30.js, 30.js.map () 14 kB  [rendered]
chunk {31} 31.js, 31.js.map () 9.68 kB  [rendered]
chunk {32} 32.js, 32.js.map () 9.55 kB  [rendered]
chunk {33} 33.js, 33.js.map () 9.39 kB  [rendered]
chunk {34} 34.js, 34.js.map () 9.28 kB  [rendered]
chunk {35} 35.js, 35.js.map () 11.3 kB  [rendered]
chunk {36} 36.js, 36.js.map () 11.1 kB  [rendered]
chunk {37} 37.js, 37.js.map () 11.4 kB  [rendered]
chunk {38} 38.js, 38.js.map () 11.2 kB  [rendered]
chunk {39} 39.js, 39.js.map () 10.7 kB  [rendered]
chunk {40} 40.js, 40.js.map () 10.5 kB  [rendered]
chunk {41} 41.js, 41.js.map () 7.25 kB  [rendered]
chunk {42} 42.js, 42.js.map () 7.08 kB  [rendered]
chunk {43} 43.js, 43.js.map () 35.8 kB  [rendered]
chunk {44} 44.js, 44.js.map () 35.7 kB  [rendered]
chunk {45} 45.js, 45.js.map () 17.4 kB  [rendered]
chunk {46} 46.js, 46.js.map () 16.7 kB  [rendered]
chunk {47} 47.js, 47.js.map () 17.3 kB  [rendered]
chunk {48} 48.js, 48.js.map () 16.7 kB  [rendered]
chunk {49} 49.js, 49.js.map () 4.56 kB  [rendered]
chunk {50} 50.js, 50.js.map () 2.48 kB  [rendered]
chunk {51} 51.js, 51.js.map () 2.45 kB  [rendered]
chunk {52} 52.js, 52.js.map () 12.7 kB  [rendered]
chunk {53} 53.js, 53.js.map () 12.7 kB  [rendered]
chunk {54} 54.js, 54.js.map () 15.6 kB  [rendered]
chunk {55} 55.js, 55.js.map () 15.2 kB  [rendered]
chunk {56} 56.js, 56.js.map () 15.5 kB  [rendered]
chunk {57} 57.js, 57.js.map () 15.1 kB  [rendered]
chunk {58} 58.js, 58.js.map () 24.5 kB  [rendered]
chunk {59} 59.js, 59.js.map () 23.2 kB  [rendered]
chunk {60} 60.js, 60.js.map () 24.7 kB  [rendered]
chunk {61} 61.js, 61.js.map () 23.5 kB  [rendered]
chunk {62} 62.js, 62.js.map () 11 kB  [rendered]
chunk {63} 63.js, 63.js.map () 10.9 kB  [rendered]
chunk {64} 64.js, 64.js.map () 15.6 kB  [rendered]
chunk {65} 65.js, 65.js.map () 15.4 kB  [rendered]
chunk {66} 66.js, 66.js.map () 18.6 kB  [rendered]
chunk {67} 67.js, 67.js.map () 18.1 kB  [rendered]
chunk {68} 68.js, 68.js.map () 18.5 kB  [rendered]
chunk {69} 69.js, 69.js.map () 18.1 kB  [rendered]
chunk {70} 70.js, 70.js.map () 11.2 kB  [rendered]
chunk {71} 71.js, 71.js.map () 11.3 kB  [rendered]
chunk {72} 72.js, 72.js.map () 2.8 kB  [rendered]
chunk {73} 73.js, 73.js.map () 14.1 kB  [rendered]
chunk {74} 74.js, 74.js.map () 13.6 kB  [rendered]
chunk {75} 75.js, 75.js.map () 2.93 kB  [rendered]
chunk {76} 76.js, 76.js.map () 19.4 kB  [rendered]
chunk {77} 77.js, 77.js.map () 19 kB  [rendered]
chunk {78} 78.js, 78.js.map () 21.1 kB  [rendered]
chunk {79} 79.js, 79.js.map () 20.5 kB  [rendered]
chunk {80} 80.js, 80.js.map () 15.7 kB  [rendered]
chunk {81} 81.js, 81.js.map () 15.6 kB  [rendered]
chunk {82} 82.js, 82.js.map () 7.73 kB  [rendered]
chunk {83} 83.js, 83.js.map () 2.9 kB  [rendered]
chunk {84} 84.js, 84.js.map () 2.85 kB  [rendered]
chunk {85} 85.js, 85.js.map () 14.9 kB  [rendered]
chunk {86} 86.js, 86.js.map () 18.3 kB  [rendered]
chunk {87} 87.js, 87.js.map () 16.9 kB  [rendered]
chunk {88} 88.js, 88.js.map () 16.7 kB  [rendered]
chunk {89} 89.js, 89.js.map () 16.1 kB  [rendered]
chunk {90} 90.js, 90.js.map () 14 kB  [rendered]
chunk {91} 91.js, 91.js.map () 13.5 kB  [rendered]
chunk {92} 92.js, 92.js.map () 13.3 kB  [rendered]
chunk {93} 93.js, 93.js.map () 13 kB  [rendered]
chunk {94} 94.js, 94.js.map () 9.05 kB  [rendered]
chunk {95} 95.js, 95.js.map () 1.6 kB  [rendered]
chunk {96} 96.js, 96.js.map () 11.4 kB  [rendered]
chunk {97} 97.js, 97.js.map () 11.1 kB  [rendered]
chunk {98} 98.js, 98.js.map () 9.7 kB  [rendered]
chunk {99} 99.js, 99.js.map () 9.71 kB  [rendered]
chunk {100} 100.js, 100.js.map () 27.4 kB  [rendered]
chunk {101} 101.js, 101.js.map () 26.1 kB  [rendered]
chunk {102} 102.js, 102.js.map () 27.8 kB  [rendered]
chunk {103} 103.js, 103.js.map () 26.7 kB  [rendered]
chunk {104} 104.js, 104.js.map () 6.59 kB  [rendered]
chunk {105} 105.js, 105.js.map () 6.57 kB  [rendered]
chunk {106} 106.js, 106.js.map () 12.7 kB  [rendered]
chunk {107} 107.js, 107.js.map () 12.5 kB  [rendered]
chunk {108} 108.js, 108.js.map () 12.7 kB  [rendered]
chunk {109} 109.js, 109.js.map () 12.5 kB  [rendered]
chunk {110} 110.js, 110.js.map () 15.5 kB  [rendered]
chunk {111} 111.js, 111.js.map () 15.4 kB  [rendered]
chunk {112} 112.js, 112.js.map () 15.9 kB  [rendered]
chunk {113} 113.js, 113.js.map () 15.4 kB  [rendered]
chunk {114} 114.js, 114.js.map () 14.8 kB  [rendered]
chunk {115} 115.js, 115.js.map () 14.5 kB  [rendered]
chunk {116} 116.js, 116.js.map () 11.5 kB  [rendered]
chunk {117} 117.js, 117.js.map () 14.7 kB  [rendered]
chunk {118} 118.js, 118.js.map () 1.28 kB  [rendered]
chunk {119} 119.js, 119.js.map () 2.36 kB  [rendered]
chunk {120} 120.js, 120.js.map () 1.39 kB  [rendered]
chunk {121} 121.js, 121.js.map () 8.11 kB  [rendered]
chunk {122} 122.js, 122.js.map () 5.15 kB  [rendered]
chunk {123} 123.js, 123.js.map () 9.87 kB  [rendered]
chunk {124} 124.js, 124.js.map () 4.67 kB  [rendered]
chunk {125} 125.js, 125.js.map () 1.8 kB  [rendered]
chunk {126} 126.js, 126.js.map () 1.03 kB  [rendered]
chunk {127} 127.js, 127.js.map () 3.49 kB  [rendered]
chunk {128} 128.js, 128.js.map () 7.29 kB  [rendered]
  ionic:cli-utils:lib:hooks Looking for ionic:build:after npm script. +35s

Do the files exist locally?
Are you accessing the uploaded files directly on the (sub)domain or via a folder?
Try to remove the “base href” meta tag in index.html if you are loading it in a folder.

Below is the file structure of newly created Ionic 4 project with index.html where I am getting above error.

I haven’t modified anything in index.html and didn’t added or removed any files.

Without base href I am getting below error in devtools.


Can you please let me know what files should I need to add or is there any modification required in index.html ?

The project is generated in www, look there for the files that are listed in red as missing. (Look at where it is trying to load it again, probably in a sub folder)

Answer this question please.

Red listed files exist in www folder (not in subfolder of www) as shown in below snapshot.

temp

I have tried accessing files directly from folder and uploaded files on domain also. But getting same error on both the ways.

In Ionic 3, I was doing browser build using npm run ionic:build --prod but it is not working in Ionic 4 and giving below error:

npm ERR! missing script: ionic:build

From what URL is it trying to load these files then if they do exist in the folder?

One last time this question.

Sorry but as of now I am not able to provide domain URL.
I have tried removing base href but it is showing above error. Can you please provide steps to debug ?

I don’t want you URL. I want to know if you are opening the app via a) example.org or sub.example.org or b) example.org/folder.

Reply to my questions.

Is it trying to load them from the same folder? Or folder above? Or a completely different folder?
This is relevant as you said the files are in the same folder as index.html.

I am opening app via example.org/folder URL.

While searching about this, I have noticed If I remove base href and add RouterModule.forRoot(routes, {useHash: true}); in app-routing.module.ts , it worked without any error but app URL contains # which we don’t want.

Is there anyway to get URL without # ?

Removing the base href should be enough to get your app loading the files.

I have tried removing base href also but it is throwing below error:

Error: No base href set. Please provide a value for the APP_BASE_HREF token or add a base element to the document.

copy your package.json here please

Please find below package.json

{
  "name": "test",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "~6.1.1",
    "@angular/core": "~6.1.1",
    "@angular/forms": "~6.1.1",
    "@angular/http": "~6.1.1",
    "@angular/platform-browser": "~6.1.1",
    "@angular/platform-browser-dynamic": "~6.1.1",
    "@angular/router": "~6.1.1",
    "@ionic-native/core": "5.0.0-beta.15",
    "@ionic-native/splash-screen": "5.0.0-beta.15",
    "@ionic-native/status-bar": "5.0.0-beta.15",
    "@ionic/angular": "4.0.0-beta.7",
    "core-js": "^2.5.3",
    "npm": "^6.4.1",
    "rxjs": "6.2.2",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angular/cli": "~6.1.1",
    "@angular/compiler": "~6.1.1",
    "@angular/compiler-cli": "~6.1.1",
    "@angular/language-service": "~6.1.1",
    "@angular-devkit/architect": "~0.7.2",
    "@angular-devkit/build-angular": "~0.7.2",
    "@angular-devkit/core": "~0.7.2",
    "@angular-devkit/schematics": "~0.7.2",
    "@ionic/ng-toolkit": "^1.0.0",
    "@ionic/schematics-angular": "^1.0.0",
    "@types/jasmine": "~2.8.6",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~10.9.2",
    "codelyzer": "~4.4.2",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~3.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.0",
    "karma-jasmine": "~1.1.1",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.11.0",
    "typescript": "~2.9.2"
  },
  "description": "An Ionic project"
}