如何在Windows上正确安装引导快照

时间:2019-04-25 21:33:04

标签: ruby-on-rails ruby windows rubygems ruby-on-rails-5

我正在尝试使用rails installer在ruby上安装ruby。当我使用“ rails new blog”来启动网页时,我总是遇到构建本地扩展的错误。安装sqlite3时,我也遇到类似的问题。同样的问题也出现在我的笔记本电脑上。 (两个窗口)

到目前为止,我尝试下载此演练(https://github.com/Shopify/bootsnap/issues/134),但是当它告诉我执行脚本时却陷入困境。我试着在irb中运行给定脚本,因为它逐行表示并复制粘贴。我也尝试过gem install bootsnapgem install bundler --force。我还尝试过从Rails安装程序分别为2.5和2.6下载不同版本的红宝石。

Installing bootsnap 1.4.4 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/bootsnap-1.4.4/ext/bootsnap
C:/RailsInstaller/Ruby2.3.3/bin/ruby.exe -I
C:/RailsInstaller/Ruby2.3.3/lib/ruby/site_ruby/2.3.0 -r
./siteconf20190425-5616-1pnzlwm.rb extconf.rb
creating Makefile

current directory:
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/bootsnap-1.4.4/ext/bootsnap
make "DESTDIR=" clean

current directory:
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/bootsnap-1.4.4/ext/bootsnap
make "DESTDIR="
generating bootsnap-i386-mingw32.def
compiling bootsnap.c
bootsnap.c: In function 'bs_cache_path':
bootsnap.c:245:3: warning: unknown conversion type character 'l' in format
[-Wformat]
bootsnap.c:245:3: warning: too many arguments for format [-Wformat-extra-args]
bootsnap.c: In function 'bs_rb_fetch':
bootsnap.c:286:3: warning: ISO C90 forbids mixed declarations and code
[-Wdeclaration-after-statement]
bootsnap.c: In function 'fetch_cached_data':
bootsnap.c:412:3: warning: comparison is always false due to limited range of
data type [-Wtype-limits]
bootsnap.c: In function 'atomic_write_cache_file':
bootsnap.c:484:3: warning: implicit declaration of function 'mkstemp'
[-Wimplicit-function-declaration]
bootsnap.c: In function 'bs_rb_fetch':
bootsnap.c:632:13: warning: 'output_data' may be used uninitialized in this
function [-Wmaybe-uninitialized]
bootsnap.c:603:9: note: 'output_data' was declared here
linking shared-object bootsnap/bootsnap.so
bootsnap.o: In function `atomic_write_cache_file':
C:\RailsInstaller\Ruby2.3.3\lib\ruby\gems\2.3.0\gems\bootsnap-1.4.4\ext\bootsnap/bootsnap.c:484:
undefined reference to `mkstemp'
collect2.exe: error: ld returned 1 exit status
make: *** [bootsnap.so] Error 1

make failed, exit code 2

Gem files will remain installed in
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/bootsnap-1.4.4 for
inspection.
Results logged to
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/bootsnap-1.4.4/gem_make.out

An error occurred while installing bootsnap (1.4.4), and Bundler cannot
continue.
Make sure that `gem install bootsnap -v '1.4.4' --source
'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  bootsnap

老实说,我没想到在使用Rails安装程序时会出现这样的问题,我可以立即开始工作。

3 个答案:

答案 0 :(得分:0)

这是sqlite。

tokenSourceFromJSON

Bootsnap 2.3.3我无法运行它并升级了ruby的版本。如果您从下面的链接下载Ruby + Devkit 2.5.5-1(x64),希望这个问题会得到改善。 Ruby 2.5.5

答案 1 :(得分:0)

我在使用Rails 5.2.3和ruby 2.3时遇到了相同的捆绑软件安装问题。从AngelofDawn找到了最近对我有用的帖子:将gemfile中的bootsnap gem更改为

gem 'bootsnap', '=1.4.1', require: false

Getting error (exit code 2) for bootsnap, not allowing to set up Rails Server

仍在寻找“为什么”

答案 2 :(得分:0)

我使用以下方法解决它:

gem 'bootsnap', require: false

来源:https://stackoverflow.com/a/56275766/534600