Search code examples
node.jsnpmgulpfontello

Gulp Fontello Erroring with adm-zip, recent phenomenon


I use gulp-fontello in a gulp build script. It's been working for years just fine, until recently I'm getting this error when I run the fontello task:

Error: Invalid filename
    at new module.exports (F:\Websites\olivebranch\wp-content\themes\wpx\assets\node_modules\adm-zip\adm-zip.js:22:10)
    at processResponse (F:\Websites\olivebranch\wp-content\themes\wpx\assets\node_modules\gulp-fontello\lib\index.js:37:15)
    at F:\Websites\olivebranch\wp-content\themes\wpx\assets\node_modules\gulp-fontello\lib\index.js:88:11
    at done (F:\Websites\olivebranch\wp-content\themes\wpx\assets\node_modules\needle\lib\needle.js:460:14)
    at PassThrough.<anonymous> (F:\Websites\olivebranch\wp-content\themes\wpx\assets\node_modules\needle\lib\needle.js:711:9)
    at PassThrough.emit (events.js:182:13)
    at PassThrough.EventEmitter.emit (domain.js:459:23)
    at endReadableNT (_stream_readable.js:1094:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
[11:22:12] 'fontello' errored after 592 ms

I have dozens of different installs that make use of this task. At first I thought something was changed in node (perhaps a new version of adm-zip?) but it turns out all my old installs fail on the task too. The older installs which haven't been run npm install in the past few weeks:

 Error: Invalid filename
    at formatError (C:\Users\Daniel Quinn\AppData\Roaming\npm\node_modules\gulp\node_modules\gulp-cli\lib\versioned\^4.0.0\format-error.js:20:10)
    at Gulp.<anonymous> (C:\Users\Daniel Quinn\AppData\Roaming\npm\node_modules\gulp\node_modules\gulp-cli\lib\versioned\^4.0.0\log\events.js:31:15)
    at Gulp.emit (events.js:187:15)
    at Gulp.EventEmitter.emit (domain.js:441:20)
    at Object.error (F:\Websites\osrplus\wp-content\themes\corscova\assets\node_modules\undertaker\lib\helpers\createExtensions.js:61:10)
    at handler (F:\Websites\osrplus\wp-content\themes\corscova\assets\node_modules\now-and-later\lib\mapSeries.js:47:14)
    at f (F:\Websites\osrplus\wp-content\themes\corscova\assets\node_modules\once\once.js:25:25)
    at f (F:\Websites\osrplus\wp-content\themes\corscova\assets\node_modules\once\once.js:25:25)
    at tryCatch (F:\Websites\osrplus\wp-content\themes\corscova\assets\node_modules\async-done\index.js:24:15)
    at done (F:\Websites\osrplus\wp-content\themes\corscova\assets\node_modules\async-done\index.js:40:12)

It seems like a filename has changed inside Fontello itself?


Solution

  • If you are using the host option on your gulp task check the set protocol, it must be https in order to work as expected

    const gulp = require('gulp'),
      $ = require('gulp-load-plugins')();
    
    const options = {
      host : 'https://fontello.com',
      font : 'font',
      css : 'css'
    };
    
    gulp.task('fontello', function () {
      return gulp.src('config.json')
        .pipe($.fontello(options))
        .pipe(gulp.dest('dist'))
    });
    

    if you're not using any options, try to set the host like that

    return gulp.src('config.json')
        .pipe($.fontello({host: 'https://fontello.com'}))
        .pipe(gulp.dest('dist'));