Problems with fonts Roboto


#1

I have the following errors in the remote debugging

file:///android_asset/www/assets/fonts/roboto-regular.woff2 Failed to load resource: net::ERR_FILE_NOT_FOUND
file:///android_asset/www/assets/fonts/roboto-medium.woff2 Failed to load resource: net::ERR_FILE_NOT_FOUND
vendor.js:111891 Ionic Native: deviceready event fired after 5261 ms
file:///android_asset/www/assets/fonts/roboto-regular.woff Failed to load resource: net::ERR_FILE_NOT_FOUND
file:///android_asset/www/assets/fonts/roboto-medium.woff Failed to load resource: net::ERR_FILE_NOT_FOUND
file:///android_asset/www/assets/fonts/roboto-regular.ttf Failed to load resource: net::ERR_FILE_NOT_FOUND
file:///android_asset/www/assets/fonts/roboto-medium.ttf Failed to load resource: net::ERR_FILE_NOT_FOUND

to the new project generated also happens to them the same thing

This is my ionic info:

cli packages: (C:\Users\eS\AppData\Roaming\npm\node_modules)

@ionic/cli-utils  : 1.10.2
ionic (Ionic CLI) : 3.10.3

global packages:

Cordova CLI : 7.0.1

local packages:

@ionic/app-scripts : 2.1.4
Cordova Platforms  : android 6.2.3
Ionic Framework    : ionic-angular 3.6.1

System:

Android SDK Tools : 26.0.2
Node              : v6.11.0
npm               : 3.10.10
OS                : Windows 10

Help me, Please


#2

Yeah I’ve been having the same issue after I updated. I’ll dig around for some solutions.


#3

There were problems with an earlier version that fonts got deleted that shouldn’t have been.

Create a new project with ionic start and copy those files back if they are missing in your project. Then see if they stay where they are.


#4

Temporary solution:

npm install copyfiles --save

Create hooks/copy-fonts.js with code:

var copyfiles = require('copyfiles');
module.exports = function (context) {
	copyfiles([
		'node_modules/ionic-angular/fonts/**/*',
		'www/assets/fonts'
	],
	true,
	() => { });
}

in config.xml add:
<hook src="hooks/copy-fonts.js" type="after_prepare" />


#5

does not work for me, everything remains the same :fearful:


#6

Was anyone able to get a solution for this?


#7

The hook doesn’t allow me to copy all files, I decided to add each font file on it.


var copyfiles = require('copyfiles');
module.exports = function (context) {
	copyfiles([
		'node_modules/ionic-angular/fonts/roboto-medium.ttf',
        'node_modules/ionic-angular/fonts/roboto-medium.woff',
        'node_modules/ionic-angular/fonts/roboto-medium.woff2',
		'node_modules/ionic-angular/fonts/roboto-regular.ttf',
        'node_modules/ionic-angular/fonts/roboto-regular.ttf',
        'node_modules/ionic-angular/fonts/roboto-regular.woff',
        'node_modules/ionic-angular/fonts/roboto-regular.woff2',
        'node_modules/ionic-angular/fonts/roboto-bold.ttf',
        'node_modules/ionic-angular/fonts/roboto-bold.woff',
        'node_modules/ionic-angular/fonts/roboto-bold.woff2',
		'www/assets/fonts'
	],
	true,
    function (){ console.log("The font files has been copied");}
      );
};