Grunt sass don't have ruby and sass installed?

风流意气都作罢 提交于 2021-02-05 07:35:24

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!