簡體   English   中英

Gulp失敗並返回未處理的“錯誤”事件

[英]Gulp fails and returns Unhandled 'error' event

我正在運行Gulp並出現以下錯誤。

[14:16:00] Requiring external module coffee-script/register
[14:16:00] Using gulpfile ~/Documents/ion/game/Gulpfile.coffee
[14:16:00] Starting 'sass'...
[14:16:00] Starting 'coffee'...
[14:16:01] Starting 'templates'...

events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: spawn sass ENOENT
  at exports._errnoException (util.js:746:11)
  at Process.ChildProcess._handle.onexit (child_process.js:1046:32)
  at child_process.js:1137:20
  at process._tickCallback (node.js:355:11)

我的Gulpfile.coffee看起來像

gulp = require("gulp")
gutil = require("gulp-util")
concat = require("gulp-concat")
sass = require("gulp-ruby-sass")
minifyCss = require("gulp-minify-css")
rename = require("gulp-rename")
coffee = require("gulp-coffee")
sourcemaps = require("gulp-sourcemaps")
jade = require("gulp-jade")

paths =
  sass:
    source: ["styles/**/*.sass"]
    dest: './www/css'
  coffee:
    source: ["scripts/**/*.coffee"]
    dest: './www/js'
  templates:
    source: ["views/**/*.jade"]
    dest: './www'

gulp.task "default", ["sass", "coffee", "templates"]

gulp.task "templates", ->
  YOUR_LOCALS = {}

  gulp.src(paths.templates.source)
      .pipe(jade(locals: YOUR_LOCALS))
      .pipe(gulp.dest(paths.templates.dest))

gulp.task "coffee", (done) ->
  gulp.src(paths.coffee.source)
      .pipe(sourcemaps.init())
      .pipe(coffee(bare: true).on("error", gutil.log))
      .pipe(concat("application.js"))
      .pipe(sourcemaps.write())
      .pipe(gulp.dest(paths.coffee.dest))

gulp.task "sass", (done) ->
  gulp.src(paths.sass.source)
      .pipe(sass())
      .pipe(gulp.dest(paths.sass.dest))
      .pipe(minifyCss(keepSpecialComments: 0))
      .pipe(rename(extname: ".min.css"))
      .pipe(gulp.dest(paths.sass.dest))

gulp.task "watch", ->
  gulp.watch paths.sass.source, ->
    gulp.start("sass")
  gulp.watch paths.coffee.source, ->
    gulp.start("coffee")
  gulp.watch paths.templates.source, ->
    gulp.start("templates")

gulp.task 'install', ['git-check'], ->
  bower.commands.install()
    .on 'log', (data) ->
      gutil.log('bower', gutil.colors.cyan(data.id), data.message)

gulp.task 'git-check', (done) ->
  if !sh.which('git')
    console.log(
      '  ' + gutil.colors.red('Git is not installed.'),
      '\n  Git, the version control system, is required to download Ionic.',
      '\n  Download git here:', gutil.colors.cyan('http://git-scm.com/downloads') + '.',
      '\n  Once git is installed, run \'' + gutil.colors.cyan('gulp install') + '\' again.'
    )
    process.exit(1)
  done()

我不知道是什么原因引起的錯誤,因為自上次工作以來,我在代碼庫中未進行任何更改。 任何幫助,將不勝感激。 謝謝。

ENOENT錯誤表示該文件不存在。 仔細檢查sass可執行文件是否已安裝並在PATH中可用。

如果一切正常,請刪除SASS寶石並重新安裝。

另外,但不相關,您可能想看看SASS的C ++實現,它提供了更快的編譯速度https://github.com/sass/libsass

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM