ys3399gulp执行命令是的错误

2016/12 18 20:12
此文章不得转载,如有需要请联系网站管理员。

一度的温暖,一百度的爱情,来自于ys3399盈丰国际官网网址的点点滴滴

[13:47:26] Using gulpfile D:\gulpstudyone
[13:47:26] Starting 'scripts'...
ERROR: Can't find config file: .jshintrc

(Can't find config file: .jshintrc)这句找不到.jshintrc,是什么缘由呢,下面是我的配置文件:
gulp.task('scripts', function() {
  return gulp.src('src/js/*.js')
    .pipe(jshint('.jshintrc'))
    .pipe(jshint.reporter('default'))
    .pipe(concat('main.js'))
    .pipe(gulp.dest('dist/scripts'))
    .pipe(rename({ suffix: '.min' }))
    .pipe(uglify())
    .pipe(gulp.dest('dist/scripts'))
    .pipe(notify({ message: 'Scripts task complete' }));
});

这个怎样处理,还请能手辅导:

这个提示是由于在jshint中指明要调用.jshintrc,如许就需求创立一个.jshintrc的文件,并填入所指定的配置项。运用gulp的jshint可以直接配置或许留空调用默许配置,如:

gulp.task('scripts', function() {
  return gulp.src('src/js/*.js')
    .pipe(jshint())
    .pipe(concat('main.js'))
    .pipe(gulp.dest('dist/scripts'))
    .pipe(rename({ suffix: '.min' }))
    .pipe(uglify())
    .pipe(gulp.dest('dist/scripts'))
    .pipe(notify({ message: 'Scripts task complete' }));
});

或许参考jshint官方例子配置, 比方:

gulp.task('scripts', function() {
  return gulp.src('src/js/*.js')
    .pipe(jshint({
        'undef': true,
        'unused': true
    }))
    .pipe(concat('main.js'))
    .pipe(gulp.dest('dist/scripts'))
    .pipe(rename({ suffix: '.min' }))
    .pipe(uglify())
    .pipe(gulp.dest('dist/scripts'))
    .pipe(notify({ message: 'Scripts task complete' }));
});

以为不是gulp的题目,是配置jshint的题目。 读取不到.jshintrc 配置文件 看 jshint的配置 http://jshint.com/docs/

JSHint comes with a default set of warnings but it was designed to be very configurable. There are three main ways to configure your copy of JSHint: you can either specify the configuration file manually via the –config flag, use a special file .jshintrc or put your config into your projects package.json file under the jshintConfig property. In case of .jshintrc, JSHint will start looking for this file in the same directory as the file that’s being linted. If not found, it will move one level up the directory tree all the way up to the filesystem root. (Note that if the input comes from stdin, JSHint doesn’t attempt to find a configuration file)

是不是你项目没有配置.jshintrc文件?

(看完/读完)这篇文章有何感想! 来看看ys3399盈丰国际官网网址是怎么评论的吧!

--转载请注明: ys3399盈丰国际官网_www.ys3399.com_ys3399盈丰国际官网网址 » ys3399gulp执行命令是的错误

发表评论

(必填)