How to resolve "You need to have Ruby and Sass installed and in your PATH for this task to work" Warning?
Solution 1
Ok I got it. I just had to install Sass using gem install sass
and now everything is fine...couldn't be easier.
Solution 2
If you're on OSX El Capitan or Yosemite on Mac there seem to be an issue installing the gem.
Try
sudo gem install -n /usr/local/bin sass
Solution was from github.
Solution 3
You need to install Ruby and Sass as:
For Ruby use command
sudo apt-get install ruby-full
And for Sass use command
sudo gem install sass
Solution 4
grunt-sass documentation is not very clear. To avoid the need of Ruby, you can try this:
npm uninstall --save grunt-contrib-sass
npm install --save node-sass grunt-sass
Try this, It's work for me.
Solution 5
You need to install Ruby and Sass as:
For Ruby use command
sudo apt-get install ruby-full
And for Sass use command
sudo gem install sass
Sven
Updated on August 14, 2020Comments
-
Sven almost 4 years
I am in the process of setting up a new Mac for work. I have installed Grunt & Grunt CLI globally. Then I did a
npm install
inside a project folder to install all dependencies.No problems so far, but as soon as I try to run the
sass:dist
task, I get this warning: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.
What I understand is that I need to have Ruby and Sass installed on a more global level for this task to run. As I am still pretty new to working with the terminal, I did a quick search to find out what
PATH
is - seems like its some system path (that can be changed) where important data is stored.Does this mean I can simply do a
sudo grunt install contrib-sass -g
to resolve the issue? And what about Ruby – I always thought its already installed on OS X? -
myol over 9 yearssudo apt-get install ruby-compass : seems to install both on Ubuntu - Ruby wasn't installed in my case
-
Krzysztof Wolny almost 9 yearsOn my Mac
sudo
was required beforegem install sass
. -
Matt Canty over 8 yearsThis is the same for Windows
-
Dragos Rusu over 8 years(Win7) I had to manually add the Ruby bin path into PATH - only afterwards the gem install sass worked.
-
stevek-pro over 8 yearsWorks also on Yosemite.
-
Maxime Lafarie over 8 yearsWorks well for El Capitan !
-
filipst about 7 yearsWelcome to the Stack Overflow. You should add some more description to your answer. It is not best practice to post answers with just one sentence.
-
Danilo Cândido over 6 yearsI already had ruby installed and only the command sudo gem install sass worked for me.
-
Danilo Cândido over 6 yearsjust -> gem install sass
-
Alexander Rice over 4 yearsThis is the best answer in 2020. It makes SASS work like a charm and keeps all of the dependencies locally installed via npm. When adapting my code from grunt-contrib-sass to grunt-sass, I needed to make some adjustments to my grunt config, but their usage example made it easy: github.com/sindresorhus/grunt-sass#usage
-
Tobias about 4 yearsGreat, thanks for the tip! Had been searching how to get rid of that dependency to Ruby and you answered it. I would however use rather
npm install --save-dev
instead of--save
because you only need sass for development (I just edited this in the answer). -
Sergio Zaharchenko about 2 yearsBut after that, I had to change my Gruntfile.js:
const sass = require("node-sass"); grunt.initConfig({ sass: { options: { implementation: sass } }
Source: stackoverflow.com/a/68104462/6909703