我正在运行 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 gem 并重新安装。
此外,但不相关,您可能想看看 SASS 的 C++ 实现,它提供了更快的编译 https://github.com/sass/libsass
关于javascript - Gulp 失败并返回 Unhandled 'error' 事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30716350/