我无法使用 RubyInstaller for Windows 在 Windows 上安装 Haml/Sass
我以前从未使用过 ruby,我只是想玩一下 HAML 和 SASS。我下载并安装了 Ruby 的 Windows 安装程序 ( v1.9.1)。然后,我单击了 ruby.exe(图中带有黑色窗口和彩色宝石的图标)。最后,我输入 gem install haml
并按 Enter
。但什么也没发生。我做错了什么吗?
参考图片:
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?
Reference picture:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
使用 RubyInstaller 安装 Ruby,您会在“程序”菜单中获得一个快捷方式,可让您在
PATH
中使用 Ruby 打开命令提示符。如果您没有选择将 Ruby 添加到 PATH 的选项,您可以使用该快捷方式。
无论哪种情况,您输入的 gem 命令都应该在命令提示符下输入,而不是在 Ruby 本身内输入。
Installing Ruby using RubyInstaller, you get an shortcut in the Programs menu that let you open a command prompt with Ruby in the
PATH
You use that in case you didn't select the option to add Ruby to the PATH.
Either case, the gem command you typed in should be entered at the command prompt, and not inside Ruby itself.
最新版本(rubyinstaller-1.9.2-p136.exe)有问题。重命名该文件夹:c:\ruby192\lib\ruby\site_ruby 或完全删除它,这会修复“gem”
您可以执行“gem install compass”,或者如果您位于代理后面,则可能需要执行此操作。
gem install –http-proxy compass
这是一篇包含所有详细信息的博客文章:
http://francisshanahan.com/index.html php/2011/how-to-theme-sencha-touch-sass-windows/
希望有帮助,
-fs
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"
You can do "gem install compass" or if you're behind a proxy you might need to do.
gem install –http-proxy compass
Here's a blog post with all the details:
http://francisshanahan.com/index.php/2011/how-to-theme-sencha-touch-sass-windows/
Hope that helps,
-fs
这就是我在 Windows 机器上安装 ruby 和 sass 的方法: 如何在 Windows 上安装 ruby 和 sass?
this is how i installed ruby and sass on my windows machine: How to install ruby and sass on windows?
您可能需要将 Ruby 的路径放入 PATH 环境变量中才能执行此操作,但这就是我的做法:
打开命令行实用程序。然后我输入 ruby -S gem install。这就像一个魅力。
我尝试运行 Ruby,它显示空白屏幕,但允许我输入代码。当我按 CTRL + C 取消它时,也会执行我的代码。也许您需要以您现在正在尝试的方式做到这一点。我只是发现使用 ruby -S更容易。 IronRuby 给我 REPL 没有任何问题。
You might need to put the path to Ruby into the PATH environment variable to do this, but this is how I do it:
I open up the command line utility. I then type
ruby -S gem install <whatever>
. This works like a charm.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.exe 是 Ruby 解释器。如果你想在其中输入代码,显然你需要输入Ruby代码,而不是DOS命令代码。
gem
命令是一个 DOS 批处理文件 (gem.bat
)。 DOS批处理文件需要从DOS命令解释器运行。ruby.exe
is the Ruby interpreter. If you want to type code into it, you obviously need to type Ruby code into it, not DOS command code.The
gem
command is a DOS batch file (gem.bat
). DOS batch files need to be run from the DOS command interpreter.