#ruby-on-rails #ruby #bootstrap-4
#ruby-on-rails #ruby #bootstrap-4
Вопрос:
когда я делаю
gem 'bootstrap', '~> 4.1.3'
и затем
bundle install
и это показывает мне
An error occurred while installing sassc (2.4.0), and Bundler cannot continue.
Make sure that `gem install sassc -v '2.4.0' --source 'https://rubygems.org/'`
succeeds before bundling.
In Gemfile:
sass-rails was resolved to 6.0.0, which depends on
sassc-rails was resolved to 2.1.2, which depends on
sassc
моя настройка gem
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.4', '>= 5.2.4.4'
# Use sqlite3 as the database for Active Record
gem 'sqlite3', '< 1.4'
# Use Puma as the app server
gem 'puma', '~> 3.11'
# Use SCSS for stylesheets
gem 'sass-rails', '<= 6.0.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'
gem 'bootstrap', '~> 4.1.3'
gem 'jquery-rails'
gem 'sassc', '<= 2.4'
gem 'sassc-rails', '<= 2.1.2'
# 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]
x
$ gem install sassc -v ‘2.4.0’ —source ‘https://rubygems.org /’ ОШИБКА: Ошибка установки sassc: ОШИБКА: не удалось создать собственное расширение gem.
current directory: C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/sassc-2.4.0/ext
C:/RailsInstaller/Ruby2.3.3/bin/ruby.exe -r ./siteconf20201017-3012-1k739ew.rb extconf.rb
creating Makefile
current directory: C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/sassc-2.4.0/ext
make "DESTDIR=" clean
current directory: C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/sassc-2.4.0/ext
make "DESTDIR="
compiling ./libsass/src/ast.cpp
compiling ./libsass/src/ast2c.cpp
compiling ./libsass/src/ast_fwd_decl.cpp
compiling ./libsass/src/ast_sel_cmp.cpp
compiling ./libsass/src/ast_sel_super.cpp
compiling ./libsass/src/ast_sel_unify.cpp
compiling ./libsass/src/ast_sel_weave.cpp
compiling ./libsass/src/ast_selectors.cpp
compiling ./libsass/src/ast_supports.cpp
compiling ./libsass/src/ast_values.cpp
compiling ./libsass/src/backtrace.cpp
compiling ./libsass/src/base64vlq.cpp
compiling ./libsass/src/bind.cpp
compiling ./libsass/src/c2ast.cpp
compiling ./libsass/src/c99func.c
compiling ./libsass/src/cencode.c
compiling ./libsass/src/check_nesting.cpp
compiling ./libsass/src/color_maps.cpp
compiling ./libsass/src/constants.cpp
compiling ./libsass/src/context.cpp
compiling ./libsass/src/cssize.cpp
compiling ./libsass/src/emitter.cpp
compiling ./libsass/src/environment.cpp
compiling ./libsass/src/error_handling.cpp
compiling ./libsass/src/eval.cpp
compiling ./libsass/src/eval_selectors.cpp
compiling ./libsass/src/expand.cpp
compiling ./libsass/src/extender.cpp
compiling ./libsass/src/extension.cpp
compiling ./libsass/src/file.cpp
compiling ./libsass/src/fn_colors.cpp
compiling ./libsass/src/fn_lists.cpp
compiling ./libsass/src/fn_maps.cpp
compiling ./libsass/src/fn_miscs.cpp
compiling ./libsass/src/fn_numbers.cpp
compiling ./libsass/src/fn_selectors.cpp
compiling ./libsass/src/fn_strings.cpp
./libsass/src/fn_strings.cpp: In function 'Sass::PreValue* Sass::Functions::str_insert(Sass::Envamp;, Sass::Envamp;, Sass::Contextamp;, Sass::Signature, Sass::SourceSpan, Sass::Backtracesamp;, Sass::SelectorStack, Sass::SelectorStack)':
./libsass/src/fn_strings.cpp:105:19: error: 'to_string' is not a member of 'std'
./libsass/src/fn_strings.cpp: In function 'Sass::PreValue* Sass::Functions::str_slice(Sass::Envamp;, Sass::Envamp;, Sass::Contextamp;, Sass::Signature, Sass::SourceSpan, Sass::Backtracesamp;, Sass::SelectorStack, Sass::SelectorStack)':
./libsass/src/fn_strings.cpp:177:19: error: 'to_string' is not a member of 'std'
./libsass/src/fn_strings.cpp:195:19: error: 'to_string' is not a member of 'std'
make: *** [fn_strings.o] 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/sassc-2.4.0 for inspection.
Results logged to C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/sassc-2.4.0/gem_make.out
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Комментарии:
1. Каков результат запуска
gem install sassc -v '2.4.0' --source 'https://rubygems.org/'
2. @TomHarvey я добавил к сообщению
Ответ №1:
Я бы рекомендовал вам избегать использования Ruby 2.3.3. Просто возьмите 2.4.0 или выше.
Ваша ошибка заключалась в использовании Rails 5 с 2.3.3. Это просто не сработало бы — существует много конфликтов, особенно с зависимостями nokori, sqlite3, sass и tzinfo. Понизьте Rails до 4.2.8 или 4.2.11.
Могу ли я также узнать, какая ОС? Если Windows, избегайте использования Railsinstaller — все это сломано. Вместо этого используйте Rubyinstaller Devkit — могут появляться всплывающие окна о sql-адаптере, вы можете исправить это, используя это в Gemfile:
gem 'sqlite3', platforms: [:mingw, :mswin, :x64_mingw, :jruby]