1

我正在尝试在 OS X Yosemite 10.5.5 上使用插件 gulp-compass 运行以下 Gulp 任务来编译 Sass 文件。

var path = require("path");
var gulp = require("gulp");
var compass = require("gulp-compass");

gulp.task("compile2013Base", function() {
    var projectPath = path.join(__dirname, '../../ ');

    gulp.src(['../sass/desktop/css/2013/*.scss']).pipe(compass({
        project: projectPath,
        css: 'htdocs/assets/css/2013/',
        sass: 'sass/desktop/css/2013'
    })).on('error', errorHandler).pipe(gulp.dest('../../htdocs/assets/css/2013/'));
});

function errorHandler (error) {
  console.log(error.toString());
  this.emit('end');
 }

但是,当我尝试运行类似的任务时gulp compile2013Base,出现以下错误:

> gulp compile2013Base
[13:39:06] Using gulpfile [**redacted**]/scripts/js/gulpfile.js
[13:39:06] Starting 'compile2013Base'...
[13:39:06] Finished 'compile2013Base' after 9.07 ms
events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: spawn /usr/bin/compass ENOENT
    at exports._errnoException (util.js:746:11)
    at Process.ChildProcess._handle.onexit (child_process.js:1053:32)
    at child_process.js:1144:20
    at process._tickCallback (node.js:355:11)

我已经在 /usr/bin/compass 安装了 compass,并且compass在终端中运行不会显示任何错误。我不知道该怎么办,如何获取错误详细信息?

4

1 回答 1

11

这对我有帮助

sudo gem install -n /usr/local/bin compass

请参阅错误:“compass:dist”致命错误:spawn /usr/bin/compass ENOENT

于 2016-03-31T13:21:44.100 回答