4
我正在尝试使用Gulp创建包含符号链接的Mac应用程序的zip文件。我使用gulp-vinyl-zip以绕过lack of symlink support in the output of dest
创建zip文件时使用gulp-vinyl-zip创建TypeError
var gulp = require('gulp');
var zip = require('gulp-vinyl-zip');
gulp.task('default', function() {
return gulp.src('tmp/Application.app/**/*')
.pipe(zip.dest('releases/Application.zip'));
});
,但我得到了以下错误:
buffer.js:84
throw new TypeError('must start with number, buffer, array or string');
^
TypeError: must start with number, buffer, array or string
at fromObject (buffer.js:84:11)
at new Buffer (buffer.js:52:3)
at DestroyableTransform.through.obj.stream.push.File.path [as _transform] (/opt/ygor/client/node_modules/gulp-vinyl-zip/lib/zip/index.js:24:21)
at DestroyableTransform.Transform._read (/opt/ygor/client/node_modules/gulp-vinyl-zip/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:184:10)
at DestroyableTransform.Transform._write (/opt/ygor/client/node_modules/gulp-vinyl-zip/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:172:12)
at doWrite (/opt/ygor/client/node_modules/gulp-vinyl-zip/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:237:10)
at writeOrBuffer (/opt/ygor/client/node_modules/gulp-vinyl-zip/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:227:5)
at DestroyableTransform.Writable.write (/opt/ygor/client/node_modules/gulp-vinyl-zip/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:194:11)
at DestroyableTransform._transform (/opt/ygor/client/node_modules/gulp-vinyl-zip/lib/dest/index.js:13:9)
at DestroyableTransform.Transform._read (/opt/ygor/client/node_modules/gulp-vinyl-zip/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:184:10)
寻找解决的办法,我想这可能是缓冲,而不是流媒体文件的乙烯对象可能所以我试图添加乙烯基缓冲区管道:
var gulp = require('gulp');
var zip = require('gulp-vinyl-zip');
var buffer = require('vinyl-buffer');
gulp.task('default', function() {
return gulp.src('tmp/Application.app/**/*')
.pipe(buffer())
.pipe(zip.dest('releases/Application.zip'));
});
但我仍然收到相同的错误消息。作为Gulp的新手,我想我错过了一些有趣的东西。有任何想法吗?