Gulp Fontello adm-zip 出错,最近的现象

Gulp Fontello Erroring with adm-zip, recent phenomenon

我在 gulp 构建脚本中使用 gulp-fontello。它已经工作了很多年了,直到最近我在 运行 fontello 任务时遇到这个错误:

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

我有几十个不同的安装程序都使用了这个任务。起初我以为节点中发生了一些变化(也许是新版本的 adm-zip?)但事实证明我所有的旧安装也无法完成任务。过去几周未 运行 npm install 的旧安装:

 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)

似乎 Fontello 内部的文件名已更改?

尝试升级 gulp-fontello 版本 0.5.2。

或将此添加到您的 package.json

"gulp-fontello": "^0.5.2",

如果您在 gulp 任务上使用主机选项,请检查设置的协议,它必须是 https 才能按预期工作

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'))
});

如果您没有使用任何选项,请尝试像这样设置主机

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