运行gulp任务返回许多角度错误

时间:2016-06-14 08:19:46

标签: angular gulp

我在另一个项目中使用了以下gulpfile.js,效果很好。

现在我已经创建了另一个,当我试图使用gulp时 - 它会重现许多角度误差。

这是我的gulp文件:

'use strict';

const gulp = require('gulp');
const ts = require('gulp-typescript');
const uglify = require('gulp-uglify');
const concat = require('gulp-concat');
var htmlreplace = require('gulp-html-replace');
var addsrc = require('gulp-add-src');

gulp.task('app-bundle', function () {
  var tsProject = ts.createProject('tsconfig.json', {
      typescript: require('typescript'),
      outFile: 'app.js'
  });

  var tsResult = gulp.src([
    'node_modules/angular2/typings/browser.d.ts',
    'typings/main/ambient/firebase/firebase.d.ts',
    'app/**/*.ts'
  ])
    .pipe(ts(tsProject));

  return tsResult.js.pipe(addsrc.append('config-prod.js'))
                    .pipe(concat('app.min.js'))
                    .pipe(uglify())
                    .pipe(gulp.dest('./dist'));
});

gulp.task('vendor-bundle', function() {
    gulp.src([
            'node_modules/es6-shim/es6-shim.min.js',
            'node_modules/systemjs/dist/system-polyfills.js',
            'node_modules/angular2/bundles/angular2-polyfills.js',
            'node_modules/systemjs/dist/system.src.js',
            'node_modules/rxjs/bundles/Rx.js',
            'node_modules/angular2/bundles/angular2.dev.js',
            'node_modules/angular2/bundles/http.dev.js'
        ])
        .pipe(concat('vendors.min.js'))
        .pipe(uglify())
        .pipe(gulp.dest('./dist'));
});

gulp.task('html-replace',[ 'app-bundle', 'vendor-bundle' ], function() {
  gulp.src('index.html')
    .pipe(htmlreplace({
        'vendor': 'vendors.min.js',
        'app': 'app.min.js'
    }))
    .pipe(gulp.dest('dist'));
});

我得到的错误是:

    C:/xampp/htdocs/Rasaria/node_modules/@angular/common/src/directives/ng_class.d.ts(72,35): error TS2304: Cannot find name 'Set'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/common/src/facade/async.d.ts(27,33): error TS2304: Cannot find name 'Promise'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/common/src/facade/async.d.ts(28,45): error TS2304: Cannot find name 'Promise'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/common/src/facade/lang.d.ts(4,17): error TS2304: Cannot find name 'Map'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/common/src/facade/lang.d.ts(5,17): error TS2304: Cannot find name 'Set'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/common/src/facade/lang.d.ts(70,59): error TS2304: Cannot find name 'Map'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/common/src/facade/promise.d.ts(2,14): error TS2304: Cannot find name 'Promise'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/common/src/facade/promise.d.ts(8,32): error TS2304: Cannot find name 'Promise'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/common/src/facade/promise.d.ts(9,38): error TS2304: Cannot find name 'Promise'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/common/src/facade/promise.d.ts(10,35): error TS2304: Cannot find name 'Promise'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/common/src/facade/promise.d.ts(10,93): error TS2304: Cannot find name 'Promise'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/common/src/facade/promise.d.ts(11,34): error TS2304: Cannot find name 'Promise'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/common/src/facade/promise.d.ts(11,50): error TS2304: Cannot find name 'Promise'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/common/src/facade/promise.d.ts(12,32): error TS2304: Cannot find name 'Promise'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/common/src/facade/promise.d.ts(12,149): error TS2304: Cannot find name 'Promise'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/common/src/facade/promise.d.ts(13,43): error TS2304: Cannot find name 'Promise'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/common/src/forms/directives/select_control_value_accessor.d.ts(18,17): error TS2304: Cannot find name 'Map'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/common/src/pipes/async_pipe.d.ts(29,29): error TS2304: Cannot find name 'Promise'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/common/src/pipes/async_pipe.d.ts(35,38): error TS2304: Cannot find name 'Promise'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/common/src/pipes/async_pipe.d.ts(37,39): error TS2304: Cannot find name 'Promise'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/common/src/pipes/async_pipe.d.ts(39,44): error TS2304: Cannot find name 'Promise'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/compiler/src/directive_normalizer.d.ts(10,62): error TS2304: Cannot find name 'Promise'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/compiler/src/directive_normalizer.d.ts(11,95): error TS2304: Cannot find name 'Promise'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/compiler/src/facade/lang.d.ts(4,17): error TS2304: Cannot find name 'Map'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/compiler/src/facade/lang.d.ts(5,17): error TS2304: Cannot find name 'Set'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/compiler/src/facade/lang.d.ts(70,59): error TS2304: Cannot find name 'Map'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/compiler/src/offline_compiler.d.ts(32,70): error TS2304: Cannot find name 'Promise'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/compiler/src/offline_compiler.d.ts(34,85): error TS2304: Cannot find name 'Promise'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/compiler/src/output/output_ast.d.ts(417,63): error TS2304: Cannot find name 'Set'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/compiler/src/runtime_compiler.d.ts(28,44): error TS2304: Cannot find name 'Promise'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/compiler/src/selector.d.ts(51,25): error TS2304: Cannot find name 'Map'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/compiler/src/selector.d.ts(53,24): error TS2304: Cannot find name 'Map'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/compiler/src/template_parser.d.ts(37,12): error TS2304: Cannot find name 'Set'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/compiler/src/view_compiler/compile_view.d.ts(41,16): error TS2304: Cannot find name 'Map'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/compiler/src/view_compiler/compile_view.d.ts(43,13): error TS2304: Cannot find name 'Map'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/compiler/src/view_resolver.d.ts(10,13): error TS2304: Cannot find name 'Map'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/compiler/src/xhr.d.ts(6,23): error TS2304: Cannot find name 'Promise'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/compiler/testing/test_component_builder.d.ts(77,19): error TS2304: Cannot find name 'Promise'.
C:/xampp/htdocs/Rasaria/node_modules/@angular/compiler/testing/test_component_builder.d.ts(89,25): error TS2304: Cannot find name 'Map'.

还有更多...... 什么可能出错?

0 个答案:

没有答案