【问题标题】:gulp-compass error "You need to have Ruby and Compass installed and in your system PATH"gulp-compass 错误“您需要在系统路径中安装 Ruby 和 Compass”
【发布时间】:2023-03-13 23:14:02
【问题描述】:

我正在使用 gulp-compass 使用 gulp 任务将我的 scss 编译为 css。我在 Windows 7 上运行。
我的 Gulp 任务:

gulp.task('styles', function() {
      gulp.src('./sass/design.scss')
    .pipe(compass({
      config_file: './config.rb',
      css: 'stylesheets',
      sass: 'sass',
      require: ['susy', 'breakpoint']
    }))
    .pipe(gulp.dest('dest/css'));
});

我收到以下错误消息:

Error: You need to have Ruby and Compass installed and in your system PATH for this task to work.

我在系统 PATH 中安装了 Ruby 和 Compass,所以我看不出有什么问题。
我尝试重新安装 Ruby 和 Compass,但也没有用。

当我尝试在 Mac 系统上使用相同的任务时,它运行良好。

gulp-compass 插件替换为gulp-ruby-sass 不是一个选项,因为他们有一个错误,阻止我使用我需要使用的某些 sass 功能。

【问题讨论】:

  • 你是通过 Gem 还是 Npm 安装 compass 的?因为我记得几个月前我在安装 Npm 时遇到了问题,给出了同样的错误。我用 gem 修复了它安装指南针。
  • 我用 gem 安装了指南针
  • 你输入了什么来安装指南针?
  • gem install compass 之后我也尝试了: gem install compass --pre 我可以写“compass watch”,它工作正常,所以很奇怪。

标签: windows sass gulp compass


【解决方案1】:

我没有 Windows 7 环境。我认为您必须将以下路径添加到系统 PATH。

C:\Ruby193\bin

【讨论】:

  • 正如我所提到的,我已经在系统 PATH 上安装了 Ruby。我唯一能想到的是 gulp-compass 插件中的一个错误。
  • 我尝试将我的项目作为 html5-template-engine github.com/appleboy/html5-template-engine 它在 Windows XP 和 Ruby 1.9.3 上运行。
【解决方案2】:

我遇到了这个问题,并通过从我的系统路径中删除双引号来解决它。 我有一个条目:

c:\"Program Files"\Perforce;

我改成:

c:\Program Files\Perforce;

脚本显然无法处理双引号。

您也可以通过将 ruby​​ 文件夹显式添加到“外部 Web 工具”位置来解决此问题,但修复路径是更好的解决方案。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-05-21
    • 2014-06-16
    • 1970-01-01
    • 2023-03-10
    • 2014-10-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多