gulp之clean引起的错误。

发布于 2022-09-04 19:11:09 字数 7451 浏览 11 评论 0

项目构建时,这样构建时是正常的。

gulp.task('dev', ['copy'], function(){
    return gulp.start('htmlRev');
});

多了clean步骤时,如下:

var dist = './src/main/webapp';

gulp.task('dev', ['clean', 'copy'], function(){
    return gulp.start('htmlRev');
});


gulp.task('clean', function() {
    return gulp.src(dist, {read: false})
        .pipe(plumber())
        .pipe(clean());
});

报错了,为什么?

D:\nginx-1.10.2\html\git\fe_asset_platform\node_modules\.2.6.1@rimraf\rimraf.js:61
  if (options.disableGlob || !glob.hasMagic(p))
                                   ^

TypeError: glob.hasMagic is not a function
    at rimraf (D:\nginx-1.10.2\html\git\fe_asset_platform\node_modules\.2.6.1@rimraf\rimraf.js:61:36)
    at Transform._transform (D:\nginx-1.10.2\html\git\fe_asset_platform\node_modules\.0.3.2@gulp-clean\index.js:16:7)
    at Transform._read (D:\nginx-1.10.2\html\git\fe_asset_platform\node_modules\.1.0.34@readable-stream\lib\_stream_transform.js:184:10)
    at Transform._write (D:\nginx-1.10.2\html\git\fe_asset_platform\node_modules\.1.0.34@readable-stream\lib\_stream_transform.js:172:12)
    at doWrite (D:\nginx-1.10.2\html\git\fe_asset_platform\node_modules\.1.0.34@readable-stream\lib\_stream_writable.js:237:10)
    at writeOrBuffer (D:\nginx-1.10.2\html\git\fe_asset_platform\node_modules\.1.0.34@readable-stream\lib\_stream_writable.js:227:5)
    at Transform.Writable.write (D:\nginx-1.10.2\html\git\fe_asset_platform\node_modules\.1.0.34@readable-stream\lib\_stream_writable.js:194:11)
    at write (D:\nginx-1.10.2\html\git\fe_asset_platform\node_modules\.1.0.34@readable-stream\lib\_stream_readable.js:623:24)
    at flow (D:\nginx-1.10.2\html\git\fe_asset_platform\node_modules\.1.0.34@readable-stream\lib\_stream_readable.js:632:7)
    at DestroyableTransform.pipeOnReadable (D:\nginx-1.10.2\html\git\fe_asset_platform\node_modules\.1.0.34@readable-stream\lib\_stream_readable.js:664:5)
    at emitNone (events.js:80:13)
    at DestroyableTransform.emit (events.js:179:7)
    at emitReadable_ (D:\nginx-1.10.2\html\git\fe_asset_platform\node_modules\.1.0.34@readable-stream\lib\_stream_readable.js:448:10)
    at emitReadable (D:\nginx-1.10.2\html\git\fe_asset_platform\node_modules\.1.0.34@readable-stream\lib\_stream_readable.js:444:5)
    at readableAddChunk (D:\nginx-1.10.2\html\git\fe_asset_platform\node_modules\.1.0.34@readable-stream\lib\_stream_readable.js:187:9)
    at DestroyableTransform.Readable.push (D:\nginx-1.10.2\html\git\fe_asset_platform\node_modules\.1.0.34@readable-stream\lib\_stream_readable.js:149:10)
    at DestroyableTransform.Transform.push (D:\nginx-1.10.2\html\git\fe_asset_platform\node_modules\.1.0.34@readable-stream\lib\_stream_transform.js:145:32)
    at afterTransform (D:\nginx-1.10.2\html\git\fe_asset_platform\node_modules\.1.0.34@readable-stream\lib\_stream_transform.js:101:12)
    at TransformState.afterTransform (D:\nginx-1.10.2\html\git\fe_asset_platform\node_modules\.1.0.34@readable-stream\lib\_stream_transform.js:79:12)
    at DestroyableTransform.noop [as _transform] (D:\nginx-1.10.2\html\git\fe_asset_platform\node_modules\.2.0.3@through2\through2.js:26:3)
    at DestroyableTransform.Transform._read (D:\nginx-1.10.2\html\git\fe_asset_platform\node_modules\.1.0.34@readable-stream\lib\_stream_transform.js:184:10)
    at DestroyableTransform.Transform._write (D:\nginx-1.10.2\html\git\fe_asset_platform\node_modules\.1.0.34@readable-stream\lib\_stream_transform.js:172:12)
    at doWrite (D:\nginx-1.10.2\html\git\fe_asset_platform\node_modules\.1.0.34@readable-stream\lib\_stream_writable.js:237:10)
    at writeOrBuffer (D:\nginx-1.10.2\html\git\fe_asset_platform\node_modules\.1.0.34@readable-stream\lib\_stream_writable.js:227:5)
    at DestroyableTransform.Writable.write (D:\nginx-1.10.2\html\git\fe_asset_platform\node_modules\.1.0.34@readable-stream\lib\_stream_writable.js:194:11)
    at write (D:\nginx-1.10.2\html\git\node_modules\.1.0.34@readable-stream\lib\_stream_readable.js:623:24)
    at flow (D:\nginx-1.10.2\html\git\node_modules\.1.0.34@readable-stream\lib\_stream_readable.js:632:7)
    at DestroyableTransform.pipeOnReadable (D:\nginx-1.10.2\html\git\node_modules\.1.0.34@readable-stream\lib\_stream_readable.js:664:5)
    at emitNone (events.js:80:13)
    at DestroyableTransform.emit (events.js:179:7)
    at emitReadable_ (D:\nginx-1.10.2\html\git\node_modules\.1.0.34@readable-stream\lib\_stream_readable.js:448:10)
    at emitReadable (D:\nginx-1.10.2\html\git\node_modules\.1.0.34@readable-stream\lib\_stream_readable.js:444:5)
    at readableAddChunk (D:\nginx-1.10.2\html\git\node_modules\.1.0.34@readable-stream\lib\_stream_readable.js:187:9)
    at DestroyableTransform.Readable.push (D:\nginx-1.10.2\html\git\node_modules\.1.0.34@readable-stream\lib\_stream_readable.js:149:10)
    at DestroyableTransform.Transform.push (D:\nginx-1.10.2\html\git\node_modules\.1.0.34@readable-stream\lib\_stream_transform.js:145:32)
    at afterTransform (D:\nginx-1.10.2\html\git\node_modules\.1.0.34@readable-stream\lib\_stream_transform.js:101:12)
    at TransformState.afterTransform (D:\nginx-1.10.2\html\git\node_modules\.1.0.34@readable-stream\lib\_stream_transform.js:79:12)
    at DestroyableTransform.noop [as _transform] (D:\nginx-1.10.2\html\git\node_modules\.0.6.5@through2\through2.js:26:3)
    at DestroyableTransform.Transform._read (D:\nginx-1.10.2\html\git\node_modules\.1.0.34@readable-stream\lib\_stream_transform.js:184:10)
    at DestroyableTransform.Transform._write (D:\nginx-1.10.2\html\git\node_modules\.1.0.34@readable-stream\lib\_stream_transform.js:172:12)
    at doWrite (D:\nginx-1.10.2\html\git\node_modules\.1.0.34@readable-stream\lib\_stream_writable.js:237:10)
    at writeOrBuffer (D:\nginx-1.10.2\html\git\node_modules\.1.0.34@readable-stream\lib\_stream_writable.js:227:5)
    at DestroyableTransform.Writable.write (D:\nginx-1.10.2\html\git\node_modules\.1.0.34@readable-stream\lib\_stream_writable.js:194:11)
    at write (D:\nginx-1.10.2\html\git\node_modules\.1.0.34@readable-stream\lib\_stream_readable.js:623:24)
    at flow (D:\nginx-1.10.2\html\git\node_modules\.1.0.34@readable-stream\lib\_stream_readable.js:632:7)
    at DestroyableTransform.pipeOnReadable (D:\nginx-1.10.2\html\git\node_modules\.1.0.34@readable-stream\lib\_stream_readable.js:664:5)
    at emitNone (events.js:80:13)
    at DestroyableTransform.emit (events.js:179:7)
    at emitReadable_ (D:\nginx-1.10.2\html\git\node_modules\.1.0.34@readable-stream\lib\_stream_readable.js:448:10)
    at emitReadable (D:\nginx-1.10.2\html\git\node_modules\.1.0.34@readable-stream\lib\_stream_readable.js:444:5)
    at readableAddChunk (D:\nginx-1.10.2\html\git\node_modules\.1.0.34@readable-stream\lib\_stream_readable.js:187:9)
    at DestroyableTransform.Readable.push (D:\nginx-1.10.2\html\git\node_modules\.1.0.34@readable-stream\lib\_stream_readable.js:149:10)
    at DestroyableTransform.Transform.push (D:\nginx-1.10.2\html\git\node_modules\.1.0.34@readable-stream\lib\_stream_transform.js:145:32)
    at afterTransform (D:\nginx-1.10.2\html\git\node_modules\.1.0.34@readable-stream\lib\_stream_transform.js:101:12)
    at TransformState.afterTransform (D:\nginx-1.10.2\html\git\node_modules\.1.0.34@readable-stream\lib\_stream_transform.js:79:12)
    at D:\nginx-1.10.2\html\git\node_modules\.0.3.14@vinyl-fs\lib\src\getStats.js:15:5
    at FSReqWrap.oncomplete (fs.js:82:15)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文