2

I trying to use grunt-contrib-sass and receive an error:

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

But i'm sure that i already install Ruby and Sass. I have check it with below command

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

So that make me sure i already install Ruby and Sass.

But when i use

grunt sass

I receive that error.

Please help me and i really appreciate it. Sorry my English is not so good.

This is my package.json

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

and this is 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
  • See [this answer](https://stackoverflow.com/questions/20176410/how-to-resolve-you-need-to-have-ruby-and-sass-installed-and-in-your-path-for-th/48580068#48580068) on how to use grunt sass **without the need to globally install Ruby and sass**. – Tobias May 07 '20 at 08:29

1 Answers1

-1

Run gem install sass and everything should be fine. Because a fresh install fixes the installation paths and bindings.

Jeffrey de Graaf
  • 479
  • 3
  • 17