sassc 2.4.0在安装gem bootstrap时-无法安装

时间:2020-10-16 22:54:48

标签: 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

我的宝石设置

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::Env&, Sass::Env&, Sass::Context&, Sass::Signature, Sass::SourceSpan, Sass::Backtraces&, 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::Env&, Sass::Env&, Sass::Context&, Sass::Signature, Sass::SourceSpan, Sass::Backtraces&, 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 个答案:

答案 0 :(得分:0)

我建议您避免使用Ruby 2.3.3。只需2.4.0或更高版本即可。

您的错误是在2.3.3中使用Rails 5。它根本行不通-存在很多冲突,尤其是与nokori,sqlite3,sass和tzinfo依赖项有关。将Rails降级到4.2.8或4.2.11。

我还可以知道哪个操作系统吗? 如果是Windows,请避免使用Railsinstaller-这全都坏了。改用Rubyinstaller + Devkit-可能会有一些有关sql-adapter的弹出式窗口,您可以在Gemfile中使用以下方法进行修复:

gem 'sqlite3', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

Direct download here