gpt4 book ai didi

ruby-on-rails - 尝试访问数据库时找不到 gem 'rails'

转载 作者:太空宇宙 更新时间:2023-11-03 16:17:04 26 4
gpt4 key购买 nike

当我这样做时,我收到以下错误消息

rails db:schema:dump 或此目录中的任何 rails 命令

Could not find gem 'rails (~> 5.0.1) x86-mingw32' in any of the gem sources listed in your Gemfile or available on this machine.
Run `bundle install` to install missing gems.

我尝试了 bundle install 并收到了以下错误信息

>C:\Users\jalen\Documents\Sites\simple_cms>gem install rails -v 5.0.1
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.

> current directory: C:/Ruby23/lib/ruby/gems/2.3.0/gems/nio4r-1.2.1/ext/nio4r
C:/Ruby23/bin/ruby.exe -r ./siteconf20161220-8320-1xbe7zi.rb extconf.rb
checking for unistd.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

>Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/Ruby23/bin/$(RUBY_BASE_NAME)
>C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
>You have to install development tools first.
from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:587:in `try_cpp'
from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:1091:in `block in have_header'
from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:942:in `block in checking_for'
from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:350:in `block (2 levels) in >postpone'
from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:320:in `open'
from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:350:in `block in postpone'
from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:320:in `open'
from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:346:in `postpone'
from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:941:in `checking_for'
from C:/Ruby23/lib/ruby/2.3.0/mkmf.rb:1090:in `have_header'
from extconf.rb:3:in `<main>'

>To see why this extension failed to compile, please check the mkmf.log which can be found here:

>C:/Ruby23/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/nio4r->1.2.1/mkmf.log

>extconf failed, exit code 1

>Gem files will remain installed in C:/Ruby23/lib/ruby/gems/2.3.0/gems/nio4r-1.2.1 for inspection.
Results logged to C:/Ruby23/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/nio4r-1.2.1/gem_make.out

我以为我可能是 DevKit 这就是问题所在,但我已经在我的计算机上安装了 DevKit,当在另一个目录中时我可以看到我有

rails -v
Rails 5.0.1

最佳答案

我想出了答案。确保如果您下载了 x64 ruby​​ 版本,您也下载了 x64 DevKit 安装。我没有注意这一点并下载了一个非 x64 的 x64。

关于ruby-on-rails - 尝试访问数据库时找不到 gem 'rails',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41255015/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com