问题
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!
回答1:
Solution was to install Sass with sudo gem install sass
.
回答2:
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
来源:https://stackoverflow.com/questions/24269242/grunt-sass-dont-have-ruby-and-sass-installed