2017-04-24 14 views
1

私は、bower、npm、およびgulpを使用するAngularJSアプリを持っています。Gulp:SyntaxError:JSON入力の予期しない終了

gulp minifycss; 

エラー:

SyntaxError: Unexpected end of JSON input 
at Object.parse (native) 
at module.exports (..\node_modules\main-bower-files\lib\index.js:48:43) 
at Gulp.<anonymous> (..\gulpfile.js:72:33) 
at module.exports (..\node_modules\orchestrator\lib\runTask.js:34:7) 
at Gulp.Orchestrator._runTask (..\node_modules\orchestrator\index.js:273:3) 
at Gulp.Orchestrator._runStep (..\node_modules\orchestrator\index.js:214:10) 
at Gulp.Orchestrator.start (..\node_modules\orchestrator\index.js:134:8) 
at C:\Users\bgi5\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:129:20 
at _combinedTickCallback (internal/process/next_tick.js:73:7) 
at process._tickCallback (internal/process/next_tick.js:104:9) 

ガルプコード:

var cleanCss = require('gulp-clean-css'), 
filter = require('gulp-filter'), 
concat = require('gulp-concat'), 
merge = require('merge-stream'), 
bowerFiles = require('main-bower-files'); 
var config = { 
paths: { 
    src: './src', 
    build: './build', 
    bower: './bower_components' 
} 
}; 
gulp.task('minifyCss', function() { 
var v= gulp.src(bowerFiles()) 
    .pipe(filter(['**/*.css'])) 
    .pipe(concat('v.css')) 
    .pipe(cleanCss({debug: true})) 
    .pipe(gulp.dest(config.paths.build + '/styles')); 

var a= gulp.src(config.paths.src + '/**/*.css') 
    .pipe(concat('a.css')) 
    .pipe(cleanCss({debug: true})) 
    .pipe(gulp.dest(config.paths.build + '/styles')); 

return merge(v, a); 
}); 

答えて

2
このコードは、数日前に働いて、私は一口コマンドを実行したときに、なぜ私は下記取得しています確認されませんでした

これは、変数bowerFilesによって発生します。それはあなたがインストールされている亭パッケージから必要なCSSファイルを見つけていないいくつかの理由

bowerFiles = require('main-bower-files');

。エラーがJSONについて何か言っているので、あなたのバワー設定ファイルに問題があると思います。.bowerrc。それが指し示しているダブルチェックバワーのディレクトリが正しいかどうか。 .bowerrcファイルの詳細については、linkをご確認ください。

関連する問題