【问题标题】:Added ruby PATH to enviornment variables still `grunt sass` does not work向环境变量添加了 ruby​​ PATH 仍然 `grunt sass` 不起作用
【发布时间】:2017-01-06 06:18:57
【问题描述】:

好的,我先这样做了。

>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.

【问题讨论】:

  • 当您使用--force 时会发生什么?你安装sass了吗?
  • @zhon 你的意思是这样的:grunt sass --force ?当我执行 grunt-sass-force >grunt sass --force Running "sass:dist" (sass) 任务时,我得到了关注 警告:您需要安装 Ruby 和 Sass 并在您的 PATH 中才能执行此任务。更多信息:github.com/gruntjs/grunt-contrib-sass 使用 --force,继续。 'sass' 不是内部或外部命令、可运行程序或批处理文件。警告:以错误代码 1 退出已使用 --force,继续。完成,但有警告。
  • 你安装了sass gem吗?
  • @zhon 感谢帮助,我没有sass

标签: ruby sass gruntjs grunt-contrib-sass


【解决方案1】:

看来您需要安装sassgem install sass。没有 gem,你无法在 ruby​​ 中使用 sass。

【讨论】:

    【解决方案2】:

    Sass 最初是使用ruby programming language 构建的。在node 构建系统(即gruntgulpwebpack)上运行Sass 需要同时运行rubySass 以及连接它们的方法(即grunt-contrib-sass、@ 987654332@,sass-loader)。

    Ruby 插件名为gems,安装插件很简单:

    gem install sass
    

    另一方面,libsasscSass 实现,不需要 ruby。安装libsass 后,您需要一种将libsass 连接到node 的方法。您可以使用node-sass 来执行此操作。

    npm install node-sass
    

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-07-13
      • 2012-11-07
      • 1970-01-01
      • 2017-02-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-17
      相关资源
      最近更新 更多