有用gulp的大神吗? 今天脚本突然报错 TypeError: file.isSymbolic is not a function
发布于 7 年前 作者 anjostar 4375 次浏览 来自 问答

环境: macos, nodejs 8.6.0 npm 5.3.0 gulp 4.0

报错:

[14:57:34] Finished 'ESlintJS' after 1.54 s
[14:57:34] Starting 'uglifyJs'...
[14:57:34] Starting 'uglifyCss'...
[14:57:34] Starting 'uglifyHtml'...
[14:57:45] Finished 'uglifyHtml' after 11 s
[14:57:46] 'uglifyCss' errored after 12 s
[14:57:46] TypeError: file.isSymbolic is not a function
    at DestroyableTransform.normalize [as _transform] (/Users/guoxin/Documents/anxin_workspace/cooperation-html5/node_modules/vinyl-fs/lib/dest/prepare.js:31:15)
    at DestroyableTransform.Transform._read (/Users/guoxin/Documents/anxin_workspace/cooperation-html5/node_modules/readable-stream/lib/_stream_transform.js:182:10)
    at DestroyableTransform.Transform._write (/Users/guoxin/Documents/anxin_workspace/cooperation-html5/node_modules/readable-stream/lib/_stream_transform.js:170:83)
    at doWrite (/Users/guoxin/Documents/anxin_workspace/cooperation-html5/node_modules/readable-stream/lib/_stream_writable.js:406:64)
    at writeOrBuffer (/Users/guoxin/Documents/anxin_workspace/cooperation-html5/node_modules/readable-stream/lib/_stream_writable.js:395:5)
    at DestroyableTransform.Writable.write (/Users/guoxin/Documents/anxin_workspace/cooperation-html5/node_modules/readable-stream/lib/_stream_writable.js:322:11)
    at Pumpify.Duplexify._write (/Users/guoxin/Documents/anxin_workspace/cooperation-html5/node_modules/duplexify/index.js:201:22)
    at doWrite (/Users/guoxin/Documents/anxin_workspace/cooperation-html5/node_modules/readable-stream/lib/_stream_writable.js:406:64)
    at writeOrBuffer (/Users/guoxin/Documents/anxin_workspace/cooperation-html5/node_modules/readable-stream/lib/_stream_writable.js:395:5)
    at Pumpify.Writable.write (/Users/guoxin/Documents/anxin_workspace/cooperation-html5/node_modules/readable-stream/lib/_stream_writable.js:322:11)
[14:57:46] 'publish' errored after 15 s
[14:57:46] The following tasks did not complete: uglifyJs
[14:57:46] Did you forget to signal async completion?

exports.uglifyCss = function uglifyCss(done) {
    gulp.src(CONFIG.path.distCss)
        .pipe(sourcemaps.init())
        .pipe(cleanCss())
        .pipe(rev())
        .pipe(sourcemaps.write())
        .pipe(gulp.dest(CONFIG.path.publish))
        .pipe(rev.manifest('css-manifest.json'))   // 调试发现这段有问题. 
        .pipe(gulp.dest(path.join(CONFIG.path.publish, 'rev')))
        .on('finish', function () {
            done();
        });
};

之前用的还是好好的 今天突然就跪了… 同样的代码 我同事用windows 没问题 我mac就跪了 nodejs 和 npm 一致的情况下…

百度, google都没找到有解决办法 不知道怎么解决 有大神可以帮帮吗…

刚刚又试了下, 删掉node_modules重新安装就会出这个了… npm没有锁版本… 不知道npm i 升级了哪个包报了这个错… 好坑爹…

4 回复

我去, gulp 都出4.0了,那你得去官方repo提交issue,可能你还是第一个呢

@steambap 4.0出很久了…

try : npm cache clean --force

@waitingsong 问题解决了 是gulp 4.0更新到了 4.0.0-alpha.3 还原到4.0.0-alpha.2解决了。

回到顶部