【问题标题】:Solidus gem dependency issue in Rails 5Rails 5 中的 Solidus gem 依赖问题
【发布时间】:2023-04-02 21:22:02
【问题描述】:

我是 Rails 环境的新手,我正在尝试使用 Solidus gem 构建电子商务网站,但在 bundle install 命令期间遇到了依赖问题。

The dependency byebug (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for x86-mingw32 but the dependency is only for ruby. To add those platforms to the bundle, run `bundle lock --add-platform ruby`.
Fetching gem metadata from https://rubygems.org/..........
Fetching version metadata from https://rubygems.org/..
Fetching dependency metadata from https://rubygems.org/.
Resolving dependencies..................
Bundler could not find compatible versions for gem "rails":
  In snapshot (Gemfile.lock):
    rails (= 5.0.2)

  In Gemfile:
    rails (~> 5.0.2) x86-mingw32

    solidus x86-mingw32 was resolved to 1.0.0, which depends on
solidus_frontend (= 1.0.0) x86-mingw32 was resolved to 1.0.0, which
depends on
canonical-rails (~> 0.0.4) x86-mingw32 was resolved to 0.0.11, which
depends on
          rails (< 5.0, >= 3.1) x86-mingw32

    solidus x86-mingw32 was resolved to 1.0.0, which depends on
      solidus_core (= 1.0.0) x86-mingw32 was resolved to 1.0.0, which depends on
        deface (~> 1.0.0) x86-mingw32 was resolved to 1.0.2, which depends on
          rails (>= 3.1) x86-mingw32

    solidus x86-mingw32 was resolved to 1.0.0, which depends on
      solidus_core (= 1.0.0) x86-mingw32 was resolved to 1.0.0, which depends on
        rails (~> 4.2.0) x86-mingw32

Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.

以下是我的宝石文件:

source 'https://rubygems.org'

git_source(:github) do |repo_name|
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
  "https://github.com/#{repo_name}.git"
end


gem 'rails', '~> 5.0.2'
gem 'sqlite3'
gem 'puma', '~> 3.0'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.2'
gem 'jquery-rails'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'

gem 'solidus'
gem 'solidus_auth_devise'

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

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

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

我正在使用以下版本的 Rails 和 Ruby。

C:\Users\user>rails -v
Rails 5.0.2

C:\Users\user>ruby -v
ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32]

PS:我使用的是 Windows 10

【问题讨论】:

  • 这行代码gem 'byebyg', platform: :mri 怎么样。据我了解,这是 Windows 版本。您能否发表评论,敲响bundle install 并再次重新测试所有内容,看看真正的问题是什么。我也读了这篇文章。 stackoverflow.com/questions/42683402/… 运行 bundle lock --add-platform ruby 的输出是什么?
  • 在评论 byebug gem 并运行 bundle install 后给出相同的错误 - “Bundler 找不到 gem rails 的兼容版本”。 bundle lock --add-platform ruby​​ 也给出了同样的错误。我也尝试过运行 bundle update 命令,该命令运行良好,但现在遇到了“bundle exec rails g spree:install”命令的问题。它说“rake aborted - Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError”。我的机器上已经安装了 ImageMagick。

标签: ruby-on-rails ruby solidus


【解决方案1】:

在 paperclick 要求之间,您可以找到 ImageMagick: https://rubygems.org/gems/paperclip

转到 github 并按照说明进行操作。 https://github.com/thoughtbot/paperclip

以下帖子为您提供 Windows 环境中回形针错误的解决方案 Paperclip::Errors::NotIdentifiedByImageMagickError on Windows 7

相对于第一个错误“Bundler 找不到 gem rails 的兼容版本”,我找到了以下帖子。 他们说运行rm Gemfile.lock 并再次运行bundle install,但我很担心。你不应该编辑你的 Gemfile.lock 这将删除它 Bundler could not find compatible versions for gem, updating Rails app

只是注意到您的 gemfile 上没有 ruby​​ 版本,而且您使用的是 rails 5.0.2,它是非常新的版本。 您能否发布终端命令ruby -vrails -v 的输出。然后你可以运行 bundle list 并发布输出。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-10-19
    • 1970-01-01
    • 1970-01-01
    • 2011-07-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多