1

I am trying to make the server start its my first time using rails. So I am using

 ruby bin\rails server

It gave me:

Could not find gem 'turbolinks (~> 5) x86-mingw32' in any of the gem 
sources listed in your Gemfile.
Run `bundle install` to install missing gems.

When running bundle install It gave me:

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.

When I try the command it gives me:

Error installing bootsnap:
    ERROR: Failed to build gem native extension.

This is a snippet of the error log:

Fetching bootsnap 1.4.4
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 -r ./siteconf20190516-15728-gz8r2f.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

The GemFile:

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.3.3'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2.3'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use Puma as the app server
gem 'puma', '~> 3.11'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
gem 'duktape'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use ActiveStorage variant
# gem 'mini_magick', '~> 4.8'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.1.0', require: false

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end

group :development do
  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
  gem 'web-console', '>= 3.3.0'
end

group :test do
  # Adds support for Capybara system testing and selenium driver
  gem 'capybara', '>= 2.15'
  gem 'selenium-webdriver'
  # Easy installation and use of chromedriver to run system tests with Chrome
  gem 'chromedriver-helper'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
Mahdi Jaber
  • 231
  • 1
  • 4
  • 12
  • Could you include a snippet of the error log? There could be several reasons why the build could have failed and usually the error log should be having that information. – elixir May 15 '19 at 22:48
  • I added the error log – Mahdi Jaber May 15 '19 at 22:54
  • As you can see in the error log, the `bootsnap` gem itself seems to be buggy. Try updating the related gem version in your `Gemfile` or removing the version to use the latest one. If that doesn't work, include your `Gemfile` too in the question. Would be better for debugging. – elixir May 15 '19 at 23:04
  • Yes sir, I added the GemFile as per request – Mahdi Jaber May 15 '19 at 23:22
  • It worked for me. Can you try uninstalling the gem using `gem uninstall bootsnap -v '1.4.4'` and reinstalling using `gem install bootsnap -v '1.4.4'` – elixir May 15 '19 at 23:32
  • same error nothing changed – Mahdi Jaber May 15 '19 at 23:40
  • Possible duplicate: https://stackoverflow.com/questions/55857930/how-can-i-properly-install-bootsnap-on-windows – elixir May 15 '19 at 23:42

4 Answers4

1

There is problem with ruby version and bootsnap gem version. so upgrade your ruby version '2.3.7' or '2.4.5' as per rails 5.2.3

Which Ruby on Rails is compatible with which Ruby version?

0

I had exact similar problem...took me hours I couldn't figure it out. I manually changed the version to gem 'bootsnap', '>= 1.4.4', require: false, but it didn't work.

So I solved by commenting out. This is because I figured out my application would still work without bootsnap, since it is useful for speeding up boot time by caching expensive operations.

To do so, go to Gemfile and comment out bootsnap like this:

#gem 'bootsnap', '>= 1.4.4', require: false

Then go to boot.rb file in config and comment out like below:

#require 'bootsnap/setup' # Speed up boot time by caching expensive operations.

After that, do

bundle install

and then fire up my rails server as below:

rails s

0

I tried what you had suggested:-

But it did not work - My server fired up but could load my app - My patience was tested.

Uncommented -

require 'bootsnap/setup' # Speed up boot time by caching expensive 
operations.

gem 'bootsnap', '>= 1.4.4', require: false 

and run

Bundle Install

Fired up my server and my App was up running in seconds

cotieno
  • 11
  • 2
0

This happened to me today as I was trying out Rails 6. On my local machine, I have Ruby version 2.7.0 installed, as well as Rails version 6.0.1. Turns out, I had just upgraded my Mac's OS to Catalina. The fix for me was to run in Terminal

xcode-select --install

I ran this in my ~ directory, not sure if this will matter as the xcode installation is most likely global. After running this, I changed back to my new Rails app directory, ran bundle and everything installed without issue, including bootsnap and pg.

Hope this helps any Mac users who have recently upgraded their OS. Note, I was previously running Mojave and still needed to reinstall xcode, after having it installed already when I was running Mojave.

CJD
  • 28
  • 5