使用gulp-compass时出现“错误:spawn / usr / bin / compass ENOENT”

时间:2015-10-28 20:49:53

标签: node.js gulp gulp-compass

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

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没有显示任何错误。 我不知道该怎么做,如何获取错误详情?

1 个答案:

答案 0 :(得分:10)

这对我有所帮助

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

请参阅Error: "compass:dist" Fatal error: spawn /usr/bin/compass ENOENT