javascript - BrowserSync throws a TypeError on init -
browsersync throws typeerror
when initalizes:
[12:02:53] typeerror: undefined not function @ object.init (/users/conti/dev/foodjournal-web/node_modules/browser-sync/lib/public/init.js:25:25) @ gulp.<anonymous> (/users/conti/dev/foodjournal-web/gulpfile.js:39:15) @ module.exports (/users/conti/dev/foodjournal-web/node_modules/gulp/node_modules/orchestrator/lib/runtask.js:34:7) @ gulp.orchestrator._runtask (/users/conti/dev/foodjournal-web/node_modules/gulp/node_modules/orchestrator/index.js:273:3) @ gulp.orchestrator._runstep (/users/conti/dev/foodjournal-web/node_modules/gulp/node_modules/orchestrator/index.js:214:10) @ gulp.orchestrator.start (/users/conti/dev/foodjournal-web/node_modules/gulp/node_modules/orchestrator/index.js:134:8) @ gulp.<anonymous> (/users/conti/dev/foodjournal-web/node_modules/gulp/index.js:36:18) @ gaze.<anonymous> (/users/conti/dev/foodjournal-web/node_modules/gulp/node_modules/vinyl-fs/node_modules/glob-watcher/index.js:18:14) @ gaze.emit (events.js:110:17) @ 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)
that points browser-sync
gulp task:
gulp.task('browser-sync', function () { browsersync.init({ server: { basedir: "./public" } }) })
after rechecking docs, task setup correctly. idea causing type error?
opened github issue: https://github.com/browsersync/browser-sync/issues/761
i answered on github because found first there. maybe people want read here too. had same issue.
the following fixed issue:
note little comment before .create in first line
browsersync = require('browser-sync')#.create #call wherever heck want gulp = require('gulp-param')(require('gulp'), process.argv) gulp.task 'default', ['browser-sync', 'watch'], -> gulp.task 'browser-sync', -> browsersync.init( server: "./build") gulp.task 'watch', -> #something todo
my json file version checking: [...]
"devdependencies": { "browser-sync": "^2.12.5", "gulp": "^3.9.1", "gulp-jshint": "^2.0.0", "jshint": "^2.9.2", "jshint-stylish": "^2.1.0" }
Comments
Post a Comment