【问题标题】:SASS TASK in GRUNT ERROR: you need to have Ruby and Sass installedGRUNT ERROR 中的 SASS TASK:您需要安装 Ruby 和 Sass
【发布时间】:2014-12-02 19:58:37
【问题描述】:

我尝试使用 grunt-contrib-sass 并收到错误:

You need to have Ruby and Sass installed and in your PATH for this task to work.

但我确定我已经安装了 Ruby 和 Sass。 我已经用下面的命令检查了它

ruby -v and receive 1.9.3p545
sass -v and receive 3.4.5

这样我就可以确定我已经安装了 Ruby 和 Sass。

但是当我使用时

grunt sass

我收到了那个错误。

请帮助我,我真的很感激。 对不起,我的英语不太好。

这是我的 package.json

{
    "name": "TEST",
    "version": "0.0.1",
    "dependencies": 
    {
        "grunt": "~0.4.5",
        "grunt-contrib-sass": "~0.8.1"
    }
}

这是 gruntfile.js

module.exports = function(grunt)
{
grunt.loadNpmTasks('grunt-contrib-sass');

grunt.initConfig
({
    sass: 
    {                              
        dist: 
        {                            
            options: 
            {                       
                style: 'compressed'
            },//options
            files: 
            {                         
                'css/style.css': 'component/sass/style.scss'
            }//files
        }//dist
    }//sass
})//initConfig
}//exports

【问题讨论】:

  • 查看this answer,了解如何使用 grunt sass无需全局安装 Ruby 和 sass

标签: css sass gruntjs


【解决方案1】:

运行gem install sass,一切都会好起来的。因为全新安装修复了安装路径和绑定。

【讨论】:

  • @cinnamon 这很好,但要解决路径问题,应该重新安装。
猜你喜欢
  • 2014-08-07
  • 2017-01-26
  • 2015-10-24
  • 1970-01-01
  • 2015-11-22
  • 2020-03-05
  • 2023-04-08
  • 1970-01-01
  • 2017-10-15
相关资源
最近更新 更多