我gulpfile.js
在Visual Studio 2015项目中创建了一个。它已设置为后构建。当我编译我的项目时,我在Task Runner Explorer中看到以下消息。下面是gulp文件的源代码
任务运行器中的错误消息
cmd.exe /c gulp -b "C:\Tom\Personal\PracticeProjects\Angular2\AspNet5Angular2Demo\src\AspNet5Angular2Demo" --color --gulpfile "C:\Tom\Personal\PracticeProjects\Angular2\AspNet5Angular2Demo\src\AspNet5Angular2Demo\Gulpfile.js" default
[12:06:26]
Process terminated with code 1
吞咽文件
var gulp = require('gulp');
gulp.task('moveToLibs', function (done) {
gulp.src([
'node_modules/angular2/bundles/js',
'node_modules/angular2/bundles/angular2.*.js*',
'node_modules/angular2/bundles/angular2-polyfills.js',
'node_modules/angular2/bundles/http.*.js*',
'node_modules/angular2/bundles/router.*.js*',
'node_modules/es6-shim/es6-shim.min.js*',
'node_modules/angular2/es6/dev/src/testing/shims_for_IE.js',
'node_modules/systemjs/dist/*.*',
'node_modules/jquery/dist/jquery.*js',
'node_modules/bootstrap/dist/js/bootstrap*.js',
'node_modules/rxjs/bundles/Rx.js'
]).pipe(gulp.dest('./wwwroot/libs/'));
gulp.src([
'node_modules/bootstrap/dist/css/bootstrap.css'
]).pipe(gulp.dest('./wwwroot/libs/css'));
});
我已将上面的代码修改如下,但仍然得到相同的错误。我已经安装并且在我的文件merge2
下也提到了。devDependencies
package.json
包.json
{
"version": "0.0.0",
"name": "Angular2AspNetCoreDemo",
"dependencies": {
"angular2": "2.0.0-beta.17",
"systemjs": "0.19.27",
"es6-promise": "^3.1.2",
"es6-shim": "^0.35.0",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.6",
"zone.js": "0.6.12",
"bootstrap": "^3.3.6",
"jquery": "^2.2.3"
},
"devDependencies": {
"gulp": "^3.9.1",
"merge2": "1.0.2"
}
}
gulpfile.js
/// <binding AfterBuild='default' />
var gulp = require('gulp');
var merge2 = require('merge2');
gulp.task('moveToLibs', function (done) {
return merge2
(
gulp.src([
'node_modules/angular2/bundles/js',
'node_modules/angular2/bundles/angular2.*.js*',
'node_modules/angular2/bundles/angular2-polyfills.js',
'node_modules/angular2/bundles/http.*.js*',
'node_modules/angular2/bundles/router.*.js*',
'node_modules/es6-shim/es6-shim.min.js*',
'node_modules/angular2/es6/dev/src/testing/shims_for_IE.js',
'node_modules/systemjs/dist/*.*',
'node_modules/jquery/dist/jquery.*js',
'node_modules/bootstrap/dist/js/bootstrap*.js',
'node_modules/rxjs/bundles/Rx.js'
]).pipe(gulp.dest('./wwwroot/libs/')),
gulp.src([
'node_modules/bootstrap/dist/css/bootstrap.css'
]).pipe(gulp.dest('./wwwroot/libs/css')))
});
我也尝试在我的 gulp 文件中将其作为两个单独的任务,但仍然出现相同的错误
/// <binding AfterBuild='default' />
var gulp = require('gulp');
gulp.task('moveToLibs', function (done) {
gulp.src([
'node_modules/angular2/bundles/js',
'node_modules/angular2/bundles/angular2.*.js*',
'node_modules/angular2/bundles/angular2-polyfills.js',
'node_modules/angular2/bundles/http.*.js*',
'node_modules/angular2/bundles/router.*.js*',
'node_modules/es6-shim/es6-shim.min.js*',
'node_modules/angular2/es6/dev/src/testing/shims_for_IE.js',
'node_modules/systemjs/dist/*.*',
'node_modules/jquery/dist/jquery.*js',
'node_modules/bootstrap/dist/js/bootstrap*.js',
'node_modules/rxjs/bundles/Rx.js'
]).pipe(gulp.dest('./wwwroot/libs/'))
});
gulp.task('moveToLibsCss', function (done) {
gulp.src([
'node_modules/bootstrap/dist/css/bootstrap.css'
]).pipe(gulp.dest('./wwwroot/libs/css'))
});