Ошибка глотка с angular2
У меня ошибка при развертывании углового проекта с использованием.gulp в.netCore
Package.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".
... }
Gulp Сообщение об ошибке
[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. Билет говорит, что это было исправлено начиная с beta15, поэтому я добавляю последнюю версию 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 ссылок
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
);
});