我正在尝试安装trackingJs,并且正在设置环境,但是我收到此错误消息:任务“ serve”不在您的gulpfile中。如果有人以前使用过此工具,并且可能会向我详细建议如何正确设置我的环境,那么我正在努力进行大量设置。我真的很感激。
这里是网站链接:https://trackingjs.com/docs.html
error:
抛出错误; ^
Error: Cannot find module '/Users/alex/Downloads/tracking.js-master/server'
at Function.Module._resolveFilename (module.js:455:15)
at Function.Module._load (module.js:403:25)
at Module.runMain (module.js:590:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
Alexs-MacBook-Pro-2:tracking.js-master alex$ node gulpfile.js
Alexs-MacBook-Pro-2:tracking.js-master alex$ gulp serve
[12:59:06] Using gulpfile ~/Downloads/tracking.js-master/gulpfile.js
[12:59:06] Task 'serve' is not in your gulpfile
[12:59:06] Please check the documentation for proper gulpfile formatting
Alexs-MacBook-Pro-2:tracking.js-master alex$
'use strict';
var gulp = require('gulp');
var concat = require('gulp-concat');
var header = require('gulp-header');
var jsdoc = require('gulp-jsdoc');
var jshint = require('gulp-jshint');
var nodeunit = require('gulp-nodeunit');
var pkg = require('./package.json');
var rename = require('gulp-rename');
var rimraf = require('gulp-rimraf');
var stylish = require('jshint-stylish');
var uglify = require('gulp-uglify');
var esformatter = require('gulp-esformatter');
var runSequence = require('run-sequence');
gulp.task('all', ['clean'], function() {
return runSequence(['build', 'build-data']);
});
gulp.task('clean', function() {
return gulp.src('build').pipe(rimraf());
});
gulp.task( 'default', [ 'serve' ] );
gulp.task('build', function() {
var files = [
'src/tracking.js',
'src/utils/EventEmitter.js',
'src/utils/Canvas.js',
'src/utils/DisjointSet.js',
'src/utils/Image.js',
'src/detection/ViolaJones.js',
'src/features/Brief.js',
'src/features/Fast.js',
'src/math/Math.js',
'src/math/Matrix.js',
'src/pose/EPnP.js',
'src/trackers/Tracker.js',
'src/trackers/TrackerTask.js',
'src/trackers/ColorTracker.js',
'src/trackers/ObjectTracker.js',
'src/trackers/LandmarksTracker.js',
'src/alignment/Regressor.js',
'src/alignment/LBF.js'
];
return gulp.src(files)
.pipe(concat('tracking.js'))
.pipe(banner())
.pipe(gulp.dest('build'))
.pipe(uglify())
.pipe(rename({
suffix: '-min'
}))
.pipe(banner())
.pipe(gulp.dest('build'));
});
gulp.task('build-data', function() {
return gulp.src('src/detection/training/haar/**.js')
.pipe(banner())
.pipe(gulp.dest('build/data'))
.pipe(rename({
suffix: '-min'
}))
.pipe(uglify())
.pipe(banner())
.pipe(gulp.dest('build/data'));
});
gulp.task('docs', function() {
return gulp.src(['src/**/*.js', 'README.md'])
.pipe(jsdoc('docs'));
});
gulp.task('format', function() {
return gulp.src(['src/**/*.js', '!src/detection/training/**/*.js'])
.pipe(esformatter())
.pipe(gulp.dest('src'));
});
gulp.task('lint', function() {
return gulp.src('src/**/**.js')
.pipe(jshint())
.pipe(jshint.reporter(stylish));
});
gulp.task('test', function(cb) {
gulp.src('test/*.js')
.pipe(nodeunit())
.on('end', cb);
});
gulp.task('test-watch', function() {
return gulp.watch(['src/**/*.js', 'test/**/*.js'], ['test']);
});
gulp.task('watch', function() {
gulp.watch('src/**/*.js', ['build']);
gulp.watch('src/data/*.js', ['build-data']);
});
// Private helpers
// ===============
function banner() {
var stamp = [
'/**',
' * <%= pkg.name %> - <%= pkg.description %>',
' * @author <%= pkg.author.name %> <<%= pkg.author.email %>>',
' * @version v<%= pkg.version %>',
' * @link <%= pkg.homepage %>',
' * @license <%= pkg.license %>',
' */',
''
].join('\n');
return header(stamp, { pkg: pkg });
}
答案 0 :(得分:0)
gulp.task( 'default', [ 'serve' ] );
您提到默认任务是服务,但没有:
gulp.task('serve', function() { ...
要在您的代码中找到
编辑: 该项目本身指出:
在工作时,您需要一个基本的HTTP服务器来服务您的页面。通过加载项目的完成版本来测试Web服务器。
此服务器不包含在您的下载文件中。该gulp脚本中也不包含它。为了轻松提供文件,您可以例如使用http-server:
运行一次:
npm install http-server -g
要启动服务器:
cd /Users/alex/Downloads/tracking.js-master
http-server
或
http-server /Users/alex/Downloads/tracking.js-master
您的项目将在以下位置访问:
等