我无法在 Windows 上使用 RubyInstaller for Windows 安装 Haml/Sass
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3085866/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
I can't install Haml/Sass on Windows using RubyInstaller for Windows
提问by alexchenco
I never used ruby before, I just wanted to play around with HAML and SASS. I downloaded and installed Ruby's Windows installer(v1.9.1). Then, I clicked ruby.exe
(the icon with a black window and a multicolored gem in the picture). Finally, I typed gem install haml
and pressed Enter
. But nothing happened. Am I doing something wrong?
我以前从未使用过 ruby,我只是想玩弄 HAML 和 SASS。我下载并安装了Ruby 的 Windows 安装程序(v1.9.1)。然后,我单击了ruby.exe
(图中带有黑色窗口和彩色宝石的图标)。最后,我输入gem install haml
并按下Enter
。但什么也没发生。难道我做错了什么?
Reference picture:
参考图片:
回答by Tacoman667
You might need to put the path to Ruby into the PATH environment variable to do this, but this is how I do it:
您可能需要将 Ruby 的路径放入 PATH 环境变量中才能执行此操作,但我是这样做的:
I open up the command line utility. I then type ruby -S gem install <whatever>
. This works like a charm.
我打开命令行实用程序。然后我输入ruby -S gem install <whatever>
. 这就像一个魅力。
I tried running Ruby and it shows a blank screen but lets me type code. When I press CTRL + C to cancel it then executes my code as well. Maybe you need to do that in the manner you are trying to right now. I just find it easier to just ruby -S <statement>
instead. IronRuby gives me the REPL no problems though.
我尝试运行 Ruby,它显示一个空白屏幕,但让我输入代码。当我按 CTRL + C 取消它时,也会执行我的代码。也许您需要以您现在正在尝试的方式来做到这一点。我只是觉得更容易ruby -S <statement>
。IronRuby 给我的 REPL 没有问题。
回答by J?rg W Mittag
ruby.exe
is the Ruby interpreter. If you want to type code into it, you obviously need to type Rubycode into it, not DOS command code.
ruby.exe
是 Ruby 解释器。如果你想在其中输入代码,你显然需要在其中输入Ruby代码,而不是 DOS 命令代码。
The gem
command is a DOS batch file (gem.bat
). DOS batch files need to be run from the DOS command interpreter.
该gem
命令是一个 DOS 批处理文件 ( gem.bat
)。DOS 批处理文件需要从 DOS 命令解释器运行。
回答by Luis Lavena
Installing Ruby using RubyInstaller, you get an shortcut in the Programs menu that let you open a command prompt with Ruby in the PATH
使用 RubyInstaller 安装 Ruby,您会在“程序”菜单中看到一个快捷方式,让您可以在 PATH
You use that in case you didn't select the option to add Ruby to the PATH.
如果您没有选择将 Ruby 添加到 PATH 的选项,则可以使用它。
Either case, the gem command you typed in should be entered at the command prompt, and not inside Ruby itself.
无论哪种情况,您输入的 gem 命令都应该在命令提示符下输入,而不是在 Ruby 内部输入。
回答by Francis Shanahan
The latest build (rubyinstaller-1.9.2-p136.exe) had a problem. Rename the folder: c:\ruby192\lib\ruby\site_ruby or delete it altogether and this fixes "gem"
最新版本 (rubyinstaller-1.9.2-p136.exe) 有问题。重命名文件夹:c:\ruby192\lib\ruby\site_ruby 或完全删除它,这会修复“gem”
You can do "gem install compass" or if you're behind a proxy you might need to do. gem install –http-proxy compass
您可以执行“gem install compass”,或者如果您使用代理,则可能需要这样做。gem install –http-proxy 指南针
Here's a blog post with all the details: http://francisshanahan.com/index.php/2011/how-to-theme-sencha-touch-sass-windows/
这是一篇包含所有详细信息的博客文章:http: //francisshanahan.com/index.php/2011/how-to-theme-sencha-touch-sass-windows/
Hope that helps, -fs
希望有帮助,-fs
回答by Damodar Bashyal
this is how i installed ruby and sass on my windows machine: How to install ruby and sass on windows?
这就是我在 Windows 机器上安装 ruby 和 sass 的方式:如何在 Windows 上安装 ruby 和 sass?