Windows 7 - How to resolve “You need to have Ruby and Sass installed and in your PATH for this task to work” Warning? - ruby

Most answers and solutions are related to OSX, it is focused in Windows 7:
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 "grunt build" command, I get this warning in my project:
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.

Ok. This worked for me:
1) Download Ruby from http://rubyinstaller.org/
2) When you install, check the 'PATH' option. This is the key.
3) Once installed, open the prompt (you can use interactive ruby) and write
gem install sass
Now it should work.

Let's consider that newbie people most of the time try to use these commands:
npm install ruby
npm install sass
It won't work.
Solution:
Download and install Ruby from here “http://rubyinstaller.org/”
Execute in a command prompt window “gem install sass”
Only downloading Ruby independently it works. If you try npm install ruby it won't work.
Hope it helps to solve this problem in your case.

To avoid the need of Ruby, you can try this:
npm uninstall --save grunt-contrib-sass
npm install --save node-sass grunt-sass
Source:
https://github.com/gruntjs/grunt-contrib-sass/issues/229#issuecomment-281284894

Related

Using a gulp project on another machine

I have gulp set up and working fine on one machine.
I have copied the directory to another machine which includes the package.json file that includes all the project dependencies.
Each time I run 'gulp' on the new machine it runs through the task but always finishes with
Error: Gem sass is not installed.
I have run sudo npm install to install dependencies from the the package.json and even tried to run npm install --save-dev gulp-ruby-sass
ANy ideas? thanks
It looks like your project uses the ruby gem sass, which means you need to run the following on each machine:
[sudo] gem install sass
For a bit more info, SASS started as a ruby gem but libSass allows users to run SASS using other languages.

Error: spawn ENOENT: missing the sass executable

I'm using bash in windows.
Getting this error when trying to run a sass compiler command via gulp.
I have Ruby & Sass installed.
Sass works fine when running it manually.
Error: spawn ENOENT: missing the sass executable. Please install sass and make available on your PATH
I have included the directory of my ruby bin in the PATH var (system variables within Enviroment variables).
Anyone got any ideas?
I had the same issue, fixed it by typing this;
sudo gem install sass
Your gulp-ruby-sass task is probably configured to execute SASS using Bundler (a gem dependency manager). When you don't have Bundler installed, that execution will fail with the error message you've quoted. Check your task configuration for the parameter "bundleExec" and make sure it's set to false, that way gulp-ruby-sass will run the SASS command directly.
A reboot didn't fix it unfortunately.
I swapped out the gulp-ruby-sass for the gulp-sass plugin and all is working fine.
It's hardly a fix but it served as a solution for me.
Instead of installing ruby-sass, I simply ran
npm i -g sass
Then replaced "sass" in gulp.js to "sass.cmd" for Windows
For my case the error was:
gulp-notify: [Error running Gulp] Error: spawn sass ENOENT
To fix it, I did the following:
In your project root:
npm install --save-dev gulp-ruby-sass
Which installed: gulp-ruby-sass#1.0.5 node_modules/gulp-ruby-sass
Then:
sudo gem install sass

How to resolve "You need to have Ruby and Sass installed and in your PATH for this task to work" Warning?

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?
Ok I got it. I just had to install Sass using gem install sass and now everything is fine...couldn't be easier.
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.
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
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.
reference
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
Use grunt --force if you are using grunt.
If you want to run an application using grunt and a warning is occur like this. For ignoring this warning you can use --force.
Also simply brew install saas/sass/sass on Mac High Sierra (10.13.x)
I used Homebrew to install Ruby and then Ruby to install SASS. Probably only the best way to do it if you already use Homebrew, or want to start using it regularly...
brew install ruby
gem install sass

Why does Grunt not add itself to the shell?

I have a problem installing grunt. All the documentation, and blog post tutorials, say that running:
npm install -g grunt
will then allow you to run grunt commands from the terminal.
I have a situation where grunt appears to install with no errors, but typing the command grunt in the terminal still gives:
-bash: grunt: command not found
What could I be doing wrong? And where could I find grunt to add it to my BASH profile manually?
Since Grunt version 0.4 (which was released 1 or 2 weeks ago) you need to install the grunt command line tool globally (if needed, use sudo before the command):
npm install -g grunt-cli
In your project location you then install the latest grunt version:
npm install grunt --save-dev
Option --save-dev will save the npm config in your package.json file, which makes it easier to install or reinstall the dependencies (using just npm install).
Try running the install with the verbose flag:
npm install -g grunt --verbose
You can see where it is being installed (something like /usr/local/share/npm/bin/grunt). Then check your path:
echo $PATH
If the path does not contain the install bin location, modify the path in your bash profile to include the location of the bin directory, then try grunt again in a fresh terminal.
UPDATE: Grunt 0.4 altered installation process. For 0.4 installs, see answer from asgoth below.
It seems that grunt in the current version 0.4.0 does not install a bin command. The last 0.3.x version is 0.3.17, which supports a bin command. To run grunt from the command line, you will want to install the grunt command line grunt-cli:
npm install -g grunt-cli --verbose
I had installed node using Homebrew and this was my solution:
set config for -g (GLOBAL) install directory directory: npm config
set prefix /Users/YOURNAME/.node/
make sure to edit PATH: sudo nano ~/.profile
add to path: export PATH=“/Users/YOURNAME/.node/bin:”$PATH
then update source: source ~/.profile
Following these steps will allow any packages installed using npm install -g somePKG to be placed in the correct location regardless of your current working directory. And by updating your $PATH correctly command line functions will work.
Information based on:
Fixing npm permissions - bit.ly/1CmIyqx

shell can't find my ruby gem/ node library

I want to interact with http app, so I find htty and http-console.
I use
gem install htty
Or
npm install http-console
But my shell seems can't these commands. So I need add to my PATH or something else?
Edit:
I am using OS X Lion and I have npm and gem,both packages are successfully installed. I try to type the two commands in terminal, but commands not found appeared.
Make sure you have gem and npm installed. Enter the following command and see if they are installed (and what versions):
gem -v && npm -v

Resources