简体   繁体   English

在Windows中离线安装Rails

[英]rails offline installation in windows

I want to install ruby on rails in offline mode (ie without internet connection). 我想以脱机模式(即没有互联网连接)在轨道上安装ruby。 So I downloaded railsinstaller-3.2.0.exe from http://railsinstaller.org/en and installed it. 因此,我从http://railsinstaller.org/en下载了railsinstaller-3.2.0.exe并进行了安装。 By the end, I had ruby installed but in order to have rails installed I ran 最后,我安装了ruby,但是为了安装滑轨,我跑了

gem install rails

and faced these errors: (meaning command needs internet connection) 并遇到以下错误:(这意味着命令需要Internet连接)

ERROR:  Loading command: install (ArgumentError)
        unknown encoding name - CP720
ERROR:  While executing gem ... (NoMethodError)
        undefined method 'invoke_with_build_args' for nil:NilClass

I mean is there any solution like downloading gems with another computer connected to internet and then copying files in the proper location in the installed directory of gems. 我的意思是,有没有其他解决方案,例如使用连接到互联网的另一台计算机下载gems,然后将文件复制到已安装的gems目录中的正确位置。

Please help me if you have any idea. 如果您有任何想法,请帮助我。

As said in a comment, it's a gem (lib) dependency issue. 如评论中所述,这是gem(lib)依赖项问题。

You might want to look into installing the bundler gem library to manage dependencies for you, with bundler you would just have to run, bundle install and it would download all the required gems for you including any gem dependencies. 您可能需要研究安装bundler gem库来为您管理依赖项,而使用bundler则只需运行,bundle安装,它将为您下载所有必需的gem,包括所有gem依赖项。

You can install bundler simply, just run 您可以简单地安装捆绑器,只需运行

gem install bundler

Then in your rails project directory, just run bundle install. 然后在您的rails项目目录中,运行bundle install。

Often to run a project (like rails for example) you might have to start it with 通常要运行一个项目(例如,像rails),您可能必须以

bundle exec rails start

To install Gem's on a non-internet connect computer you might want to refer to this answer on just that problem. 要在非互联网连接的计算机上安装Gem,您可能只想参考该问题的答案

This is the website where you can find all available ruby gems. 在此网站上 ,您可以找到所有可用的红宝石宝石。 Ruby gems download. Ruby宝石下载。 Find the one you are interested and download it. 找到您感兴趣的一个并下载。

Then move the gem in a directory of your choice and cd into that from the command prompt. 然后将gem移到您选择的目录中,并从命令提示符下将cd插入该目录。 I am using C:/ruby193/bin/pony-1.4.gem 我正在使用C:/ruby193/bin/pony-1.4.gem

Let's say that the gem we are interested in is the pony gem (smtp email). 假设我们感兴趣的宝石是小马宝石(smtp电子邮件)。

Just type gem install pony-1.4.gem 只需输入gem install pony-1.4.gem

and you should get it installed manually unless you have a restricted acc with not adequate administrative privileges. 并且您应该手动安装它,除非您具有受限的访问权限且没有足够的管理权限。

You can also refer to the official documentation on the matter. 您也可以参考此事的官方文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM