【发布时间】:2015-08-07 18:16:37
【问题描述】:
BrowserSync 在初始化时会抛出一个TypeError:
[12:02:53] TypeError: undefined is not a function
at Object.init (/Users/conti/dev/foodjournal-web/node_modules/browser-sync/lib/public/init.js:25:25)
at Gulp.<anonymous> (/Users/conti/dev/foodjournal-web/gulpfile.js:39:15)
at module.exports (/Users/conti/dev/foodjournal-web/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7)
at Gulp.Orchestrator._runTask (/Users/conti/dev/foodjournal-web/node_modules/gulp/node_modules/orchestrator/index.js:273:3)
at Gulp.Orchestrator._runStep (/Users/conti/dev/foodjournal-web/node_modules/gulp/node_modules/orchestrator/index.js:214:10)
at Gulp.Orchestrator.start (/Users/conti/dev/foodjournal-web/node_modules/gulp/node_modules/orchestrator/index.js:134:8)
at Gulp.<anonymous> (/Users/conti/dev/foodjournal-web/node_modules/gulp/index.js:36:18)
at Gaze.<anonymous> (/Users/conti/dev/foodjournal-web/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/index.js:18:14)
at Gaze.emit (events.js:110:17)
at Gaze.emit (/Users/conti/dev/foodjournal-web/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/node_modules/gaze/lib/gaze.js:129:32)
指向browser-sync gulp 任务:
gulp.task('browser-sync', function () {
browserSync.init({
server: {
baseDir: "./public"
}
})
})
重新检查文档后,任务设置正确。知道什么可能导致这种类型错误吗?
已打开 github 问题:https://github.com/BrowserSync/browser-sync/issues/761
【问题讨论】:
标签: javascript node.js gulp browser-sync