serii81
@serii81
Я люблю phр...

TypeError: Cannot read property 'match' of undefined?

Установил gulp и browser-sync:
npm i gulp browser-sync --save-dev
Вот содержимое 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"
}
}
а вот содержимое 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);
});
а вот сама ошибка:
$ 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)

В чем может быть проблема?
  • Вопрос задан
  • 1146 просмотров
Решения вопроса 1
serii81
@serii81 Автор вопроса
Я люблю phр...
Нашел ответ, нужно вместо server прописать proxy.
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы