3

When I want to use my sass task with grunt I immediately get this error:

Warning: You need to have Ruby and Sass installed and in your PATH for this task to work. More info: https://github.com/gruntjs/grunt-contrib-sass Use --force to continue.

When I use my project on my Macbook I have no problems but when I use it on my iMac I get this message. I tried reinstalling sass several times by using several methods but none of them seem to work. Anyone has an idea? My iMac is pretty new so I might forgot something?

Thanks in regard!

Tbmluijten
  • 113
  • 1
  • 3
  • 12
  • grunt-contrib-sass needs ruby in your runtime. What is the output of `ruby --version` from the console? – Dan Schnau Jun 18 '14 at 20:00
  • It says this: ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13] – Tbmluijten Jun 19 '14 at 12:26
  • Alright, how about `sass --version` ? – Dan Schnau Jun 19 '14 at 13:26
  • Command not found ;) Anny suggestions? I'm going to look how to install sass in the meanwhile. Thanks for your help! – Tbmluijten Jun 20 '14 at 11:15
  • Just installed sass with sudo gem install sass and now it works! Awesome! Just as I thought.. I was forgetting something. Thanks for helping me dsschnau! – Tbmluijten Jun 20 '14 at 11:17
  • Possible duplicate of [How to resolve "You need to have Ruby and Sass installed and in your PATH for this task to work" Warning?](http://stackoverflow.com/questions/20176410/how-to-resolve-you-need-to-have-ruby-and-sass-installed-and-in-your-path-for-th) – cimmanon Feb 22 '16 at 14:12
  • 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:28

3 Answers3

1

Solution was to install Sass with sudo gem install sass.

Dan Schnau
  • 1,505
  • 14
  • 17
1

Another solution is to install sass with npm: npm install --save-dev sass

You'll need to invoke grunt from a npm script, e.g. running npm run build with below configuration in package.json:

"scripts": {
  "build": "grunt build"
}

as this allows npm to add node modules who expose a binary(like sass) before invoking your grunt script.

If you don't like this and don't mind a global, install sass like npm install -g sass

Silviu Burcea
  • 5,103
  • 1
  • 29
  • 43
0

I was still getting error while running sudo gem install sass.

For me sudo npm install -g sass worked.

Shivani
  • 33
  • 6