在环境变量中添加了ruby PATH,但“grunt sass”仍然不起作用



首先我做了这个。

>grunt sass
Running "sass:dist" (sass) task
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.
Aborted due to warnings.

我认为这是有意义的,我需要添加路径到ruby,所以我做了。然后我检查了ruby的版本,它确实返回了一些

>ruby -v
ruby 2.2.5p319 (2016-04-26 revision 54774) [x64-mingw32]

表示我已经安装了ruby。现在grunt sass应该工作,但它没有,我得到同样的旧信息。这一个:

>grunt sass
Running "sass:dist" (sass) task
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.
Aborted due to warnings.
<标题> 更新

我得到以下当我运行grunt-sass-force:

>grunt sass --force
Running "sass:dist" (sass) task
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
 Used --force, continuing.
'sass' is not recognized as an internal or external command,
operable program or batch file.
Warning: Exited with error code 1 Used --force, continuing.
Done, but with warnings.

看起来您需要在安装gem install sass的同时安装sass。如果没有gem,你就不能使用sass。

Sass最初是使用ruby编程语言构建的。在node构建系统上运行Sass。, grunt, gulp, webpack)需要同时运行rubySass以及连接它们的方法(即。, grunt-contrib-sass, gulp-sass, sass-loader)。

Ruby插件被称为gems,安装插件很容易:

gem install sass

另一方面,libsass是Sassc实现,不需要ruby。在安装libsass之后,您将需要一种将libsass连接到node的方法。您可以使用node-sass

npm install node-sass

最后,LESSSass的竞争对手,它运行在node上,不需要rubylibsass

最新更新