2017-03-27 4 views
0

タスク実行エクスプローラでコンパイルすると、このエラーが発生します 私はanythingsを変更しないので奇妙です...とにかく私はラインで検索し、いくつかの解決策を見つけましたが、仕事。エラーTS2304:「マップ」という名前が見つかりません。角2と.netのコアを持つ

ERROR 1

... node_modules/@angular/common/src/facade/lang.d.ts(11,17): error TS2304: Cannot find name 'Map'. node_modules/@angular/common/src/facade/lang.d.ts(12,17): error TS2304: Cannot find name 'Set'. node_modules/@angular/common/src/pipes/async_pipe.d.ts(41,38): error TS2304: Cannot find name 'Promise'. ...

この私のtsconfig.json

{ 
    "compileOnSave": false, 
    "compilerOptions": { 
    "emitDecoratorMetadata": true, 
    "experimentalDecorators": true, 
    "module": "system", 
    "moduleResolution": "node", 
    "noImplicitAny": false, 
    "noEmitOnError": false, 
    "removeComments": false, 
    "target": "es5" 
    }, 

    "exclude": [ 
    "node_modules", 
    "wwwroot" 
    ] 
} 

と、この私のpackage.json

{ 
    "version": "1.0.0", 
    "name": "testapp.web", 
    "private": true, 
    "dependencies": { 
    "@angular/common": "2.0.0-rc.5", 
    "@angular/compiler": "2.0.0-rc.5", 
    "@angular/core": "2.0.0-rc.5", 
    "@angular/forms": "0.3.0", 
    "@angular/http": "2.0.0-rc.5", 
    "@angular/platform-browser": "2.0.0-rc.5", 
    "@angular/platform-browser-dynamic": "2.0.0-rc.5", 
    "@angular/router": "3.0.0-rc.1", 
    "@angular/upgrade": "2.0.0-rc.5", 
    "core-js": "^2.4.1", 
    "reflect-metadata": "^0.1.8", 
    "rxjs": "5.0.0-beta.6", 
    "systemjs": "^0.19.37", 
    "typings": "^2.1.0", 
    "zone.js": "^0.6.12" 
    }, 
    "devDependencies": { 
    "gulp": "^3.9.1", 
    "gulp-clean": "^0.3.2", 
    "gulp-concat": "^2.6.0", 
    "gulp-less": "^3.1.0", 
    "gulp-sourcemaps": "^1.6.0", 
    "gulp-typescript": "^2.13.6", 
    "gulp-uglify": "^2.0.0", 
    "typescript": "^2.2.1" 
    }, 
    "scripts": { 
    "postinstall": "typings install dt~core-js --global" 
    } 
} 

* *ソリューション見つけ**

新しいtsconfig.json

{ 
    "compileOnSave": false, 
    "compilerOptions": { 
    "emitDecoratorMetadata": true, 
    "experimentalDecorators": true, 
    "module": "system", 
    "moduleResolution": "node", 
    "noImplicitAny": false, 
    "noEmitOnError": false, 
    "removeComments": false, 
    **"target": "es6" <<-- CHANGE** 
    }, 

    "exclude": [ 
    "node_modules", 
    "wwwroot" 
    ] 
} 

新しいpackage.json

{ 
    "version": "1.0.0", 
    "name": "testapp.web", 
    "private": true, 
    "dependencies": { 
    "@angular/common": "2.0.0-rc.5", 
    "@angular/compiler": "2.0.0-rc.5", 
    "@angular/core": "2.0.0-rc.5", 
    "@angular/forms": "0.3.0", 
    "@angular/http": "2.0.0-rc.5", 
    "@angular/platform-browser": "2.0.0-rc.5", 
    "@angular/platform-browser-dynamic": "2.0.0-rc.5", 
    "@angular/router": "3.0.0-rc.1", 
    "@angular/upgrade": "2.0.0-rc.5", 
    "core-js": "^2.4.1", 
    "reflect-metadata": "^0.1.8", 
    "rxjs": "5.0.0-beta.6", 
    "systemjs": "^0.19.37", 
    "typings": "^2.1.0", 
    "zone.js": "^0.6.12", 
    **"es6-promise": "3.2.1", <<-- CHANGE 
    "es6-shim": "0.35.1"** 
    }, 
    "devDependencies": { 
    "gulp": "^3.9.1", 
    "gulp-clean": "^0.3.2", 
    "gulp-concat": "^2.6.0", 
    "gulp-less": "^3.1.0", 
    "gulp-sourcemaps": "^1.6.0", 
    "gulp-typescript": "^2.13.6", 
    "gulp-uglify": "^2.0.0", 
    "typescript": "^2.2.1" 
    }, 
    "scripts": { 
    "postinstall": "typings install dt~core-js --global" 
    } 
} 

で修飾し、このエラーを取得します。..

GulpUglifyError: unable to minify JavaScript

の場合私は第二の解決策をするn、古いブラウザとの互換性に問題はありますか?

+0

です。パッケージを復元してみてください。あなたはこれをチェックしました:https://github.com/terinjokes/gulp-uglify/issues/249 –

+0

このコードを私の 'gulp.task( 'compress'、function(cb){ pump [ gulp.src([srcPaths.js]、[ 'JS'])、 uglify()、 gulp.dest(destPaths.js) ]、 CB); });グッで ' .jsしかし卓において同じエラー – Cicciux

+0

このエラー {[GulpUglifyError:JavaScriptを縮小化することができない] obatin 原因: {[にSyntaxError:予期しないトークン:名前(AuthHttp)] メッセージ: '予期しないトークン:名前(AuthHttp)' 、 ファイル名: 'auth.http.js' ライン:24、 COL:16、 POS:1226}、 プラグイン: '飲み込む-uglify' ファイル名:「K:\\ Devの\\プロジェクト\\のMyApp \\ Scripts \\ app \\ auth.http.js '、 showStack:false} – Cicciux

答えて

0

これは、私はパッケージをインポートするとき、それが何かを逃したと思います私のgulp.js

var gulp = require('gulp'), 
    gp_clean = require('gulp-clean'), 
    gp_concat = require('gulp-concat'), 
/// gp_less = require('gulp-less'), 
    gp_sourcemaps = require('gulp-sourcemaps'), 
    gp_typescript = require('gulp-typescript'), 
    gp_uglify = require('gulp-uglify'); 
    gp_pump = require('pump'); 

/// Define paths 
var srcPaths = { 
    app: ['Scripts/app/main.ts', 'Scripts/app/**/*.ts'], 
    js: [ 
     'Scripts/js/**/*.js', 
     'node_modules/core-js/client/shim.min.js', 
     'node_modules/zone.js/dist/zone.js', 
     'node_modules/reflect-metadata/Reflect.js', 
     'node_modules/systemjs/dist/system.src.js', 
     'node_modules/typescript/lib/typescript.js' 
    ], 
    js_angular: [ 
     'node_modules/@angular/**' 
    ], 
    js_rxjs: [ 
     'node_modules/rxjs/**' 
    ] 
    ///, 
    ///less: [ 
    /// 'Scripts/less/**/*.less' 
    ///] 
}; 

var destPaths = { 
    app: 'wwwroot/app/', 
    css: 'wwwroot/css', 
    js: 'wwwroot/js/', 
    js_angular: 'wwwroot/js/@angular/', 
    js_rxjs: 'wwwroot/js/rxjs/' 
}; 

// 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() { 
    return gulp.src(srcPaths.app) 
     .pipe(gp_sourcemaps.init()) 
     .pipe(gp_typescript(require('./tsconfig.json').compilerOptions)) 
     .pipe(gp_uglify({ mangle: false })) 
     .pipe(gp_sourcemaps.write('/')) 
     .pipe(gulp.dest(destPaths.app)); 
}); 

// Delete wwwroot/app contents 
gulp.task('app_clean', function() { 
    return gulp.src(destPaths.app + "*.*", { read: false }) 
    .pipe(gp_clean({ force: true })); 
}); 

// Copy all JS files from external libraries to wwwroot/js 
gulp.task('js', function() { 
    gulp.src(srcPaths.js_angular) 
     .pipe(gulp.dest(destPaths.js_angular)); 
    gulp.src(srcPaths.js_rxjs) 
     .pipe(gulp.dest(destPaths.js_rxjs)); 
    return gulp.src(srcPaths.js) 
     .pipe(gulp.dest(destPaths.js)); 
}); 

// Delete wwwroot/js contents 
gulp.task('js_clean', function() { 
    return gulp.src(destPaths.js + "*.*", { read: false }) 
    .pipe(gp_clean({ force: true })); 
}); 

//// Process all LESS files and output the resulting CSS in wwwroot/css 
///gulp.task('less', ['less_clean'], function() { 
/// return gulp.src(srcPaths.less) 
///  .pipe(gp_less()) 
///  .pipe(gulp.dest(destPaths.css)); 
//}); 

//// Delete wwwroot/css contents 
///gulp.task('less_clean', function() { 
/// return gulp.src(destPaths.css + "*.*", { read: false }) 
///  .pipe(gp_clean({ force: true })); 
//}); 

// Watch specified files and define what to do upon file changes 
gulp.task('watch', function() { 
    gulp.watch([srcPaths.app, srcPaths.js], ['app', 'js']); 
}); 

gulp.task('compress', function (cb) { 
    pump([ 
      gulp.src(srcPaths.js), 
      uglify(), 
      gulp.dest(destPaths.js) 
    ], 
     cb 
    ); 
}); 

// Global cleanup task 
gulp.task('cleanup', ['app_clean', 'js_clean']); 

// Define the default task so it will launch all other tasks 
gulp.task('default', ['app', 'js', 'watch']); 
関連する問題