当按照 Gulp.js 代码库中的 示例 进行操作时,出现错误:
[12:27:31] Using gulpfile C:\GH\riot-tag-build\Gulpfile.js
[12:27:31] Starting 'browserify'...
_stream_readable.js:602
var written = dest.write(chunk);
^
TypeError: Object #<Readable> has no method 'write'
at write (_stream_readable.js:602:24)
at flow (_stream_readable.js:611:7)
at _stream_readable.js:579:7
at process._tickCallback (node.js:442:13)
我尝试修改源代码以满足我的需求,这是我正在努力运行的Gulpfile文件,但并没有成功。
var gulp = require('gulp');
var browserify = require('browserify');
var riotify = require('riotify');
var transform = require('vinyl-transform');
var buffer = require('gulp-buffer');
gulp.task('browserify', function () {
// set up the browserify instance on a task basis
var b = browserify({debug: true});
// transform regular node stream to gulp (buffered vinyl) stream
var browserified = transform(function(filename) {
b.add(filename);
return b.bundle();
});
return gulp.src('./main.js')
.pipe(browserified)
.pipe(gulp.dest('./dist/'));
});
gulp.task('default', ['browserify']);
整个示例可以在这里找到。
有什么想法,为什么流可能是只读的?任何帮助都将不胜感激。