簡體   English   中英

gulp Iconify任務引發錯誤TypeError:路徑必須是字符串。 收到假

[英]gulp Iconify task throws error TypeError: Path must be a string. Received false

我正在研究一個不是由我編寫的項目,其中gulp文件確實可以標識任務。 我將svg文件放在圖像中的位置,任務將這些svg文件轉換為scss / sass。 現在,當我運行該任務時,它已經給我這個TypeError了一段時間,這確實很麻煩,有時會花費很多時間。

這是gulpfile.js中iconify的代碼

var iconparams = {
src: './public/styles/images/icons/*.svg',
pngOutput: false,
scssOutput: './public/styles/sass',
scssSvgName: '_icons.scss', 
cssOutput: false,   
styleTemplate: './public/styles/icons.scss.mustache'    
}
gulp.task('iconify',function() {
   iconify(iconparams);
});

當我運行gulp iconify ,得到以下輸出和錯誤:

[18:31:08] Starting 'iconify-clean'...
[18:31:08] Finished 'iconify' after 7.55 ms
[18:31:08] Finished 'iconify-clean' after 41 ms
[18:31:08] Starting 'iconify-convert'...
[18:31:20] Finished 'iconify-convert' after 12 s
[18:31:20] Starting 'iconify-fallback'...
path.js:8
    throw new TypeError('Path must be a string. Received ' +
    ^

TypeError: Path must be a string. Received false
    at assertPath (path.js:8:11)
    at Object.posix.relative (path.js:495:3)
    at Stream.bufferContents         (/home/savitoj/Work/mercureup/node_modules/gulp-iconify/lib/iconify.js:108:41)
    at Stream.stream.write  (/home/savitoj/Work/mercureup/node_modules/through/index.js:26:11)
    at write (/home/savitoj/Work/mercureup/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:623:24)
    at flow (/home/savitoj/Work/mercureup/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:632:7)
    at DestroyableTransform.pipeOnReadable (/home/savitoj/Work/mercureup/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:664:5)
    at emitNone (events.js:80:13)
    at DestroyableTransform.emit (events.js:179:7)
    at emitReadable_ (/home/savitoj/Work/mercureup/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:448:10)
    at emitReadable (/home/savitoj/Work/mercureup/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:444:5)

我已經檢查了關於此typeError的關於Stackoverflow的其他問題 ,但沒有針對此問題的解決方案。 我看到在./public/styles/sass中的輸出已創建,但是在輸出_icons.scss之前給出了錯誤。 提前致謝。

是的,因此在仔細閱讀錯誤后我找到了解決方案,但是正如我所說的,我從其他人那里收到了此代碼。 正如它說的TypeError: Path must be a string. Received false TypeError: Path must be a string. Received false

我將線更改為

cssOutput: './public/styles/css',

它解決了這個問題。 我感到非常壓力,因為這困擾了我很長一段時間,我無法弄清楚。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM