安装 gem 时出现权限被拒绝错误
我正在尝试在 Windows XP 上安装rackamole:
S:\development\DevKit>gem install rackamole
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - S:/development/Ruby/lib/ruby/gems/1.9.1/gems/rackamole-0.4.0/...
我已检查权限:
S:\development\DevKit>notepad S:\development\Ruby\lib\ruby\gems\1.9.1\gems\rackamole-0.4.0\some.txt
并且没有任何问题。
我该如何安装宝石?
I am trying to install rackamole on Windows XP:
S:\development\DevKit>gem install rackamole
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - S:/development/Ruby/lib/ruby/gems/1.9.1/gems/rackamole-0.4.0/...
I have checked permission:
S:\development\DevKit>notepad S:\development\Ruby\lib\ruby\gems\1.9.1\gems\rackamole-0.4.0\some.txt
and didn't have any problem.
How can I install gem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
以管理员用户身份运行终端将解决此问题。
Running the terminal as
Administrator
user will solve this problem.我同意弗拉德·拉扎连科的评论。您无需将帐户添加到本地管理员组,只需右键单击终端或命令提示符并选择“以管理员身份运行”,然后再次尝试安装rackamole。
I agree with Vlad Lazarenko comment. You don't need to add your account to the local admin group, just right click the terminal or command prompt and choose "run as administrator" and try again installing the rackamole.
在 Windows 上安装 C 扩展一直是一个大而痛苦的问题,因为 Windows 不附带编译器。大多数打算在 Windows 系统上使用的 gem 都会发布具有特定平台字段的专用 gem 版本,其中包含预编译的二进制文件。 rackamole 的情况并非如此,否则它会在此处可见。
另一种解决方案是使用 gem 版本,该版本使用较新的 FFI 方法而不是 C 扩展来与本机库交互。我想这不是一个选择,因为rackamole,无论它是什么,可能只适用于C 扩展。
曾经有一个 Ruby 发行版,包括它自己的编译器和开发头文件,但我不记得名字了,也不知道它是否仍然被维护。
如果不强制使用 Windows,我建议使用对开发人员更友好的操作系统,例如 Ubuntu 或 Debian 与 rvm。
Installing C-extensions on Windows has always been a big and painful problem, as Windows doesn't ship with a compiler. Most gems which are intended to be used on Windows systems publish a specialized gem version with a specific platform field, which then would include pre-compiled binaries. This is not the case for rackamole, otherwise it would be visible here.
Another solution would be to use a version of the gem which uses the newer FFI approach instead of C-extensions to interface with native libraries. I guess this isn't an option here because rackamole, whatever that is, is probably only available with C-extensions.
There once was a Ruby distribution including its own compiler and development headers, but I can't remember the name and I don't know if its still maintained.
Should using Windows not be mandatory, I recommend using a more developer-friendly OS like Ubuntu or Debian in combination with rvm.