我正在構建一個學習React w/Flux的相對簡單的項目。我正在使用(或試圖使用)Gulp來創建一個使用Browserify,Reactify,Streamify和Uglify的自動化構建,所有這些都是通過npm安裝的。整個流程正在工作,我做了一些文件更改,重新構建,現在當我運行構建時,它正在出錯。即使在恢復更改並返回到之前的工作狀態之後。我懷疑可能是某處發生了權限更改,但我自己並沒有這樣做,所以我不確定如何進一步診斷(並且不確定問題是否存在)。gulp build上的錯誤gulp-uglify minifier'file.isNull()'錯誤
我應該補充說,起初我懷疑乙烯基流動錯誤是問題,但我在構建流程中添加了.pipe(buffer())
和vinyl-buffer
,但它沒有改變錯誤。
這裏的一飲而盡:
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var htmlreplace = require('gulp-html-replace');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var watchify = require('watchify');
var reactify = require('reactify');
var streamify = require('gulp-streamify');
var gutil = require('gulp-util');
var path = {
HTML: 'app/index.html',
MINIFIED_OUT: 'build.min.js',
OUT: 'build.js',
DEST: 'dist',
DEST_BUILD: 'dist/build',
DEST_SRC: 'dist/src',
ENTRY_POINT: './app/App.js'
};
gulp.task('build', function(){
browserify({
entries: [path.ENTRY_POINT],
transform: [reactify]
})
.bundle()
.pipe(uglify().on('error', gutil.log))
.pipe(source(path.MINIFIED_OUT))
.pipe(buffer())
.pipe(streamify(uglify(path.MINIFIED_OUT)))
.pipe(gulp.dest(path.DEST_BUILD));
});
gulp.task('replaceHTML', function(){
gulp.src(path.HTML)
.pipe(htmlreplace({
'js': 'build/' + path.MINIFIED_OUT
}))
.pipe(gulp.dest(path.DEST));
});
gulp.task('production', ['replaceHTML', 'build']);
以下是錯誤:
[09:54:33] Using gulpfile /Library/WebServer/Documents/lldb/gulpfile.js
[09:54:33] Starting 'replaceHTML'...
[09:54:33] Finished 'replaceHTML' after 8.3 ms
[09:54:33] Starting 'build'...
[09:54:33] Finished 'build' after 27 ms
[09:54:33] Starting 'production'...
[09:54:33] Finished 'production' after 7.07 μs
/Library/WebServer/Documents/lldb/node_modules/gulp-uglify/minifier.js:67
if (file.isNull()) {
^
TypeError: file.isNull is not a function
at DestroyableTransform.minify [as _transform] (/Library/WebServer /Documents/lldb/node_modules/gulp-uglify/minifier.js:67:14)
at DestroyableTransform.Transform._read (/Library/WebServer/Documents/lldb/node_modules/gulp-uglify/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:172:10)
at DestroyableTransform.Transform._write (/Library/WebServer/Documents/lldb/node_modules/gulp-uglify/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:160:12)
at doWrite (/Library/WebServer/Documents/lldb/node_modules/gulp-uglify/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:326:12)
at writeOrBuffer (/Library/WebServer/Documents/lldb/node_modules/gulp-uglify/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:312:5)
at DestroyableTransform.Writable.write (/Library/WebServer/Documents/lldb/node_modules/gulp-uglify/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js:239:11)
at Readable.ondata (/Library/WebServer/Documents/lldb/node_modules/browserify/node_modules/read-only-stream/node_modules/readable-stream/lib/_stream_readable.js:572:20)
at emitOne (events.js:77:13)
at Readable.emit (events.js:169:7)
at readableAddChunk (/Library/WebServer/Documents/lldb/node_modules/browserify/node_modules/read-only-stream/node_modules/readable-stream/lib/_stream_readable.js:195:16)
歡迎任何想法 - 謝謝。
我只是感到驚訝,有一個離散模塊用於測試'null'的相等性, –