我已閱讀並遵循給出的指示和建議here和here,但仍然無法阻止彈出錯誤。下面是安裝方向,我跟着 角度材料2生成錯誤
以下的錯誤是我tsconfig文件
{
"compileOnSave": true,
"compilerOptions": {
"typeRoots": [ "libs/@types" ],
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"noEmitOnError": true,
"noImplicitAny": false,
"outDir": "../wwwroot/appScripts/",
"removeComments": false,
"sourceMap": true,
"target": "es6",
"moduleResolution": "node"
},
"exclude": [
"node_modules",
"typings/index",
"typings/index.d.ts",
"typings/browser",
"typings/browser.d.ts"
]
}
我gulpfile
var ts = require('gulp-typescript');
var gulp = require('gulp');
var clean = require('gulp-clean');
var destPath = './wwwroot/libs/';
gulp.task('clean', function() {
return gulp.src(destPath)
.pipe(clean());
});
gulp.task("scriptsNStyles",() => {
gulp.src([
'core-js/client/**',
'systemjs/dist/system.src.js',
'reflect-metadata/**',
'rxjs/**',
'zone.js/dist/**',
'jquery/dist/jquery.*js',
'bootstrap/dist/js/bootstrap.*js',
'ng2-bootstrap/**',
'lodash/**',
'moment/**',
'symbol-observable/**',
'hammerjs/**',
'jasmine/**',
'@types/**',
'@angular/**'
], {
cwd: "node_modules/**"
})
.pipe(gulp.dest("./wwwroot/libs"));
});
var tsProject = ts.createProject('scripts/tsconfig.json'
,{ typescript: require('typescript') }
);
gulp.task('ts', function (done) {
//var tsResult = tsProject.src();
var tsResult = gulp.src(["scripts/**/*.ts","scripts/**/**/*.ts", "scripts/*.ts"])
.pipe(ts(tsProject), undefined, ts.reporter.fullReporter());
return tsResult.js.pipe(gulp.dest('./wwwroot/appScripts'));
});
gulp.task('watch', ['watch.ts']);
gulp.task('watch.ts', ['ts'], function() {
return gulp.watch('scripts/**/*.ts', ['ts']);
});
gulp.task('default', ['scriptsNStyles', 'watch']);
我的main.ts文件
/// <reference path="../wwwroot/libs/@types/hammerjs/index.d.ts" />
import { platformBrowserDynamic } from "@angular/platform-browser-dynamic";
import { AppModule } from "./app.module";
platformBrowserDynamic().bootstrapModule(AppModule);
我失去了一半的頭髮,試圖找出這一個。我確信我一定在某個地方犯了一些愚蠢的錯誤。