系统看不到导轨或其他宝石说"Rails is not currently installed on this system"



系统:OSX 10.9.5,Rails 4.0.12

在将演示应用程序的存储库克隆后(Ruby 2.1.5,Rails 4.1.0)后,我使用RVM安装,然后切换到Ruby的较旧版本,因此我可以运行演示应用程序。我遇到了运行演示应用程序的一些问题,所以我回到了我的主要项目应用程序(Ruby 2.2.4,Rails 4.0.12),试图运行rails s并获得:

Rails is not currently installed on this system. To get the latest version, simply type:
    $ sudo gem install rails
You can then rerun your "rails" command.

好吧,那真是愚蠢。铁轨就在片刻前就在这里。我尝试在Ruby 2.2.4中切换宝石,甚至在两者之间关闭终端,但仍未安装Rails。这些是我的宝石:

gemsets for ruby-2.0.0-p481 (found in /Users/localflavor/.rvm/gems/ruby-2.0.0-p481)
=> (default)
   global
gemsets for ruby-2.1.5 (found in /Users/localflavor/.rvm/gems/ruby-2.1.5)
=> (default)
   global
gemsets for ruby-2.2.1 (found in /Users/localflavor/.rvm/gems/ruby-2.2.1)
=> (default)
   global    
gemsets for ruby-2.2.2 (found in /Users/localflavor/.rvm/gems/ruby-2.2.2)
=> (default)
   global
gemsets for ruby-2.2.4 (found in /Users/localflavor/.rvm/gems/ruby-2.2.4)
=> (default)
   global
gemsets for ruby-2.3.0 (found in /Users/localflavor/.rvm/gems/ruby-2.3.0)
=> (default)
   global

ruby2.2.2.4@default中包含的宝石:

$ gem list
*** LOCAL GEMS ***
bigdecimal (default: 1.2.6)
gem-wrappers (1.2.7)
io-console (default: 0.4.3)
json (default: 1.8.1)
minitest (5.4.3)
power_assert (0.2.2)
psych (default: 2.0.8)
rake (default: 10.4.2)
rdoc (default: 4.2.0)
rvm (1.11.3.9)
test-unit (3.0.8)

ruby-2.2.4@global中包含的宝石

$ gem list
*** LOCAL GEMS ***
bigdecimal (default: 1.2.6)
gem-wrappers (1.2.7)
io-console (default: 0.4.3)
json (default: 1.8.1)
minitest (5.4.3)
power_assert (0.2.2)
psych (default: 2.0.8)
rake (default: 10.4.2)
rdoc (default: 4.2.0)
rvm (1.11.3.9)
test-unit (3.0.8)

铁轨,你在哪里?我尝试了rvm get master,重新安装Ruby 2.2.4,OpenSSL和Bundler。我尝试了所有问题中似乎相关的解决方案。所有这些无济于事。

有趣的是,我也无法安装最新版本的Ruby(2.4.0)。

$ rvm install ruby 2.4.0
ruby-2.4.0 - #removing src/ruby-2.4.0..
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.9/x86_64/ruby-2.4.0.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/localflavor/.rvm/rubies/ruby-2.4.0, this may take a while depending on your cpu(s)...
ruby-2.4.0 - #downloading ruby-2.4.0, this may take a while depending on your connection...
ruby-2.4.0 - #extracting ruby-2.4.0 to /Users/localflavor/.rvm/src/ruby-2.4.0....
ruby-2.4.0 - #configuring...................................................................
ruby-2.4.0 - #post-configuration.
ruby-2.4.0 - #compiling....................
Error running '__rvm_make -j 1',
showing last 15 lines of /Users/localflavor/.rvm/log/1487187741_ruby-2.4.0/make.log
configuring pty
configuring racc/cparse
configuring rbconfig/sizeof
configuring readline
configuring ripper
configuring rubyvm
configuring sdbm
configuring socket
configuring stringio
configuring strscan
configuring syslog
configuring zlib
exts.mk:1471: *** commands commence before first target.  Stop.
make: *** [build-ext] Error 2
++ return 2
There has been an error while running make. Halting the installation.
 

我假设铁轨在这里,只是没有看到。就像Bundler和Openssl一样。有些事,我不知道在哪里看。我如何找到它并使其重新采用?


更新

尽管我的SSL问题仍未解决,但我能够进行此解决方法以再次启动并运行轨道(感谢Kevin-T!)

由于Ruby 2.2.4的两个宝石都缺少Rails(感谢Gem List Pointers的7 Stud),因此我需要重新安装它。但是当我运行gem install rails -v 4.0.12

时,我会遇到这个错误
ERROR:  While executing gem ... (Gem::Exception)
    Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources

所以我选择了选项2:使用非HTTPS源。为此,我运行了gem source来确认我的来源是https

*** CURRENT SOURCES ***
https://rubygems.org/

我添加了带有gem source --add http://rubygems.org的新的http版本:

https://rubygems.org is recommended for security over http://rubygems.org
Do you want to add this insecure source? [yn]  y  <-- I said yes
http://rubygems.org added to sources

我检查了使用gem source添加的:

*** CURRENT SOURCES ***
https://rubygems.org/
http://rubygems.org <-- the new one

然后用gem source --remove https://rubygems.org/删除了https

https://rubygems.org/ removed from sources

此时,运行gem install rails -v 4.0.12工作。查看此帖子以安装而无需大量文档。

rvm不久前就遇到了这个问题。它早于Ruby 2.4.0,但也许您在这里遇到同样的问题?我怀疑如果您正在运行OS X 10.9,您正在运行较旧的安装。该问题推荐的解决方案是简单地使用

更新您的RVM
rvm get master

我会尝试运行它,然后重试您的RVM命令。

Sidenote:PGP验证现在是必须使用RVM的,因此您可能需要运行

gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3

首先。

当前尚未在此系统上安装Rails。获取最新 版本,只需类型:

$ sudo gem install rails

然后,您可以重新运行您的" rails"命令。


好吧,那真是愚蠢。铁轨就在片刻前就在这里。

首先警告:切勿将sudo与RVM一起使用。

使用RVM,您需要注意两件事:

  1. 红宝石版本。
  2. 宝石。

宝石就像是一个带有某些宝石的自我包含的软件包。到请参阅这些宝石,必须使用该宝石使用。如果您使用的是其他宝石,那么您将请参阅不同的宝石。

为了验证当前选择的宝石中包含的宝石,您可以执行此操作:

$ gem list

有关如何使用RVM WTIH导轨和各种宝石的一般说明,请参见:

更改RVM使用的Rails版本

有趣的是,我也无法安装最新版本 Ruby(2.4.0)。

您的输出表明RVM在编译zlib时遇到困难。看来,RBENV人群在OSX上编译了Zlib也遇到了一些问题。您可能想尝试他们的修复:

https://github.com/rbenv/ruby-build/issues/832

最新更新