当我尝试运行gulp样式时,我有一个简单的gulpfile.js我得到了一个意外的令牌错误。在.pipe,为什么?
1 var gulp = require('gulp');
2 var jshint = require('gulp-jshint');
3
4 var jsFiles = ['*.js', 'src/**/*.js'];
5
6 gulp.task('style', function(){
7 gulp.src(jsFiles)
8 .pipe(jshint())
9 .pipe(jshint.reporter('jshint-stylish',{
10 verbose: true
11 }));
12 })
我的Package.json:
1 {
2 "name": "app",
3 "version": "1.0.0",
4 "description": "",
5 "main": "app.js",
6 "scripts": {
7 "test": "echo \"Error: no test specified\" && exit 1",
8 "start": "node app.js"
9 },
10 "author": "",
11 "license": "ISC",
12 "dependencies": {
13 "express": "^4.13.3"
14 },
15 "devDependencies": {
16 "gulp": "^3.9.0",
17 "gulp-jscs": "^3.0.2",
18 "gulp-jshint": "^2.0.0",
19 "jshint-stylish": "^2.1.0"
20 }
21 }
还安装了gulp-jshint和jshint-Stylish。
答案 0 :(得分:1)
您需要确保在项目的jshint
文件中安装了jshint-stylish
和package.json
并声明为依赖项。
答案 1 :(得分:0)
您需要在gulp文件中使用jshint-stylish,然后使用它。