Ошибка глотка с angular2

У меня возникает ошибка при развертывании углового проекта с использованием .gulp в .netCore.

Пакет.json

"dependencies": {
    "@angular/common": "~2.1.0",
    "@angular/compiler": "~2.1.0",
    "@angular/core": "~2.1.0",
    "@angular/forms": "~2.1.0",
    "@angular/http": "~2.1.0",
    "@angular/platform-browser": "~2.1.0",
    "@angular/platform-browser-dynamic": "~2.1.0",
    "@angular/router": "~3.1.0",
    "@angular/upgrade": "~2.1.0",
    "@angular/angular-in-memory-web-api": "~0.1.5",
    "@angular/angular-cli": "1.0.0-beta.19-3".
    ... }

Сообщение об ошибке глотка

[13:58:40] ReferenceError: options is not defined
at Gulp.<anonymous> ("-"\Gulpfile.js:65:18)
at module.exports ("-"\node_modules\orchestrator\lib\runTask.js:34:7)
at Gulp.Orchestrator._runTask ("-"\node_modules\orchestrator\index.js:273:3)
at Gulp.Orchestrator._runStep ("-"\node_modules\orchestrator\index.js:214:10)
at "-"\node_modules\orchestrator\index.js:279:18
at finish ("-"\node_modules\orchestrator\lib\runTask.js:21:8)
at "-"\node_modules\orchestrator\lib\runTask.js:52:4
at f ("-"\node_modules\end-of-stream\node_modules\once\once.js:17:25)
at Transform.onend ("-"\node_modules\end-of-stream\index.js:31:18)
at emitNone (events.js:91:20)
at Transform.emit (events.js:185:7)
at "-"\node_modules\gulp-clean\node_modules\readable-stream\lib\_stream_readable.js:965:16
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)

После поиска этой проблемы она кажется связанной с angular-cli в соответствии с билетом angular-cli< /а>. В билете говорится, что это было исправлено, начиная с бета-версии 15, поэтому я добавляю последнюю версию angular-cli beta.19-3. Тем не менее, gulp по-прежнему показывает эту ошибку, я не уверен, что мне нужно ссылаться на angular-cli по-другому, чтобы заставить его работать. Я попробовал 2 разных подхода, используя gp_uglify и gp_uglify_harmony. Но все равно у меня такая же ошибка.

gulpfile.js (задача)

gulp.task('app', ['app_clean'], function (cb) {
    pump([
        gulp.src(srcPaths.app),
        gp_sourcemaps.init(),
        gp_typescript(require('./tsconfig.json').compilerOptions),
        //gp_uglify({ mangle: false }),
        minifier(options, gp_uglify_harmony),
        gp_sourcemaps.write('/'),
        gulp.dest(destPaths.app)
    ],
    cb
    );
});

Кажется, некоторые параметры отсутствуют, я также нахожу эти сообщения, ссылаюсь на ленивый вариант, но я застрял на том, как я должен его использовать $ Не определены скрипты Gulp task и gulp-load-plugins не загружает плагины

Редактировать. Добавляю последние 2 ссылки


person Exec21    schedule 02.11.2016    source источник


Ответы (1)


Если у кого-то есть похожая проблема, лучше всего использовать ведение журнала, это часто поможет найти корень проблемы.

// Compile, minify and create sourcemaps all TypeScript files 
// and place them to wwwroot/app, together with their js.map files.
gulp.task('app', ['app_clean'], function (cb) {
    pump([
        gulp.src(srcPaths.app),
        gp_sourcemaps.init(),
        gp_typescript(require('./tsconfig.json').compilerOptions),
        gp_uglify({mangle:false}).on('error', gutil.log),
        gp_sourcemaps.write('/'),
        gulp.dest(destPaths.app)
    ],
    cb
    );
});
person Exec21    schedule 10.11.2016