ionic-cli icon indicating copy to clipboard operation
ionic-cli copied to clipboard

Blank Project ERR_FILE_NOT_FOUND

Open Lindsor opened this issue 5 years ago • 9 comments

Description: When creating a blank cordova project with the latest Ionic cli (6.7.0) and running it on android the app doesn't load.

Steps to Reproduce:

ionic start project-name blank --cordova --type=angular
ionic cordova platform add android
ionic cordova build android

Then check the chrome console and see:

Failed to load resource: net::ERR_FILE_NOT_FOUND /polyfills-es2015.js:1
Failed to load resource: net::ERR_FILE_NOT_FOUND /styles-es2015.js:1
Failed to load resource: net::ERR_FILE_NOT_FOUND cordova.js:1
Failed to load resource: net::ERR_FILE_NOT_FOUND /vendor-es2015.js:1
Failed to load resource: net::ERR_FILE_NOT_FOUND /main-es2015.js:1
Failed to load resource: net::ERR_FILE_NOT_FOUND /assets/icon/favicon.png:1

My ionic info:

Ionic:

   Ionic CLI                     : 6.7.0 (/Users/mluz/.npm/_npx/67980/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 5.1.0
   @angular-devkit/build-angular : 0.803.26
   @angular-devkit/schematics    : 8.3.26
   @angular/cli                  : 8.3.26
   @ionic/angular-toolkit        : 2.2.0

Cordova:

   Cordova CLI       : 7.0.1
   Cordova Platforms : android 6.2.3
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 4 other plugins)

Utility:

   cordova-res : 0.14.0
   native-run  : 1.0.0

System:

   Android SDK Tools : 26.1.1 (/Users/mluz/Library/Android/sdk)
   ios-deploy        : 1.9.1
   ios-sim           : 6.0.0
   NodeJS            : v14.0.0 (/Users/mluz/.nvm/versions/node/v14.0.0/bin/node)
   npm               : 6.14.4
   OS                : macOS Mojave
   Xcode             : Xcode 11.3.1 Build version 11C504

Lindsor avatar May 04 '20 23:05 Lindsor

I'm not able to reproduce this. How are you running the app once it's built?

imhoffd avatar May 05 '20 18:05 imhoffd

Im doing the same thing i do for my other ionic projects:

npx ionic cordova build android this puts apk in platform/android/.../app-debug.apk then doing: adb install -d -r /<path-to-apk>

Lindsor avatar May 05 '20 18:05 Lindsor

What's the URL that it loads in the web view? Mine is http://localhost/home.

imhoffd avatar May 05 '20 19:05 imhoffd

@dwieeb dont kill me here. I tested 5 projects yesterday and all failed. Just did one more today to get you more details and it worked now.

I will keep an eye out and see if it comes back but i think you can close this one.

Lindsor avatar May 05 '20 19:05 Lindsor

Haha, no worries! I've definitely seen this issue reported before. It happens when there's an inconsistency with the <base href="/" /> and whatever is serving the app. It won't work on file:// protocol (i.e. you can't just open the index.html in your browser and expect it to work). It needs HTML5 routing capability, which the web view in our Cordova plugin should support.

Maybe you were testing it on a really old Android device? I'm out of ideas.

imhoffd avatar May 05 '20 20:05 imhoffd

Galaxy S20... if thats already considered old were screwed haha. It most likely has to do with some sort of version issue with either cordova or one of the dependencies.

Lindsor avatar May 05 '20 20:05 Lindsor

Yeah, it should work on an S20 😂

imhoffd avatar May 05 '20 20:05 imhoffd

This issue hasn't been solved. I ran into the same exact issue. Any solutions?

EbenOladutemu avatar Oct 15 '20 00:10 EbenOladutemu

This issue hasn't been solved. I ran into the same exact issue. Any solutions?

by removing (base href="/") and replace (base href="." )from my index.html file I fixed all the relative routes and my problem.

NabeelHaris avatar Sep 05 '21 13:09 NabeelHaris