TypeError: Cannot read property 'match' of undefined?

Installed gulp and browser-sync:
npm i gulp browser-sync --save-dev
Here are the contents of the package.json:
{
"name": "regexp",
"version": "1.0.0",
"description": "",
"main": "gulpfile.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"browser-sync": "^2.18.8",
"gulp": "^3.9.1"
}
}
but the contents gulpfile.js:
var gulp = require('gulp');
var browserSync = require('browser-sync').create();
var reload = browserSync.reload;

// Save a reference to the `reload` method

// Watch scss AND html files, doing different things with each.
gulp.task('default', function () {

// Serve files from the root of this project
browserSync.init({
proxy: {
baseDir: "./"
}
});

gulp.watch("./**/*.*").on("change", reload);
});
and here the error:
$ gulp
[20:56:57] Using gulpfile D:\WEB\OpenServer\domains\regexp\gulpfile.js
[20:56:57] Starting 'default'...
[20:56:57] 'default' errored after 5.72 ms
[20:56:57] TypeError: Cannot read property 'match' of undefined
at Object.proxy (D:\WEB\OpenServer\domains\regexp\node_modules\browser-sync\lib\cli\cli-options.js:123:20)
at D:\WEB\OpenServer\domains\regexp\node_modules\browser-sync\lib\cli\cli-options.js:280:54
at D:\WEB\OpenServer\domains\regexp\node_modules\immutable\dist\immutable.js:3018:46
at D:\WEB\OpenServer\domains\regexp\node_modules\immutable\dist\immutable.js:1379:16
at ValueNode.iterate (D:\WEB\OpenServer\domains\regexp\node_modules\immutable\dist\immutable.js:1746:12)
at BitmapIndexedNode.iterate.HashArrayMapNode.iterate [as iterate] (D:\WEB\OpenServer\domains\regexp\node_modules\immutable\dist\immutable.js:1739:24)
at HashArrayMapNode.BitmapIndexedNode.iterate.HashArrayMapNode.iterate [as iterate] (D:\WEB\OpenServer\domains\regexp\node_modules\immutable\dist\immutable.js:1739:24)
at Map.__iterate (D:\WEB\OpenServer\domains\regexp\node_modules\immutable\dist\immutable.js:1377:32)
at KeyedIterable.mappedSequence.__iterateUncached (D:\WEB\OpenServer\domains\regexp\node_modules\immutable\dist\immutable.js:3017:23)
at seqIterate (D:\WEB\OpenServer\domains\regexp\node_modules\immutable\dist\immutable.js:606:16)

What could be the problem?
June 27th 19 at 15:05
1 answer
June 27th 19 at 15:07
Solution
Found the answer, you need is to register proxy server.

Find more questions by tags Gulp.js