将新的计算机上的一年旧Rails应用程序与最新的Ruby(2.4.1)+ Rails捆绑在一起时出错

时间:2021-10-04 17:00:08

I just tried to revive an old Rails app of mine, created July 2016.

我刚刚尝试重振我的旧Rails应用程序,创建于2016年7月。

When bundling on my new machine with fresh installs of Ruby and Rails I got this error, because json is now included into rails, and not needed in the Gemfile anymore:

当我使用全新的Ruby和Rails安装在我的新机器上时,我遇到了这个错误,因为json现在包含在rails中,而不再需要在Gemfile中:

An error occurred while installing json (1.8.3), and Bundler cannot continue. Make sure that gem install json -v '1.8.3'` succeeds before bundling.

If I remove the gem from the Gemfile.lock (edit: this is probably very stupid, but there was no mention of json in the Gemfile, why i looked into the Gemfile.lock), I get Unfortunately, an unexpected error occurred, and Bundler cannot continue. on bundle install:

如果我从Gemfile.lock中删除gem(编辑:这可能是非常愚蠢的,但是在Gemfile中没有提到json,为什么我调查了Gemfile.lock),我很遗憾,发生了意外错误,并且Bundler无法继续。在捆绑安装:

The git source `git://github.com/flori/json.git` uses the `git` protocol, which transmits data without encryption. Disable this warning with `bundle config git.allow_insecure true`, or switch to the `https` protocol to keep your data secure.
The git source `git://github.com/capistrano/rbenv.git` uses the `git` protocol, which transmits data without encryption. Disable this warning with `bundle config git.allow_insecure true`, or switch to the `https` protocol to keep your data secure.
Fetching git://github.com/flori/json.git
The git source `git://github.com/flori/json.git` uses the `git` protocol, which transmits data without encryption. Disable this warning with `bundle config git.allow_insecure true`, or switch to the `https` protocol to keep your data secure.
The git source `git://github.com/capistrano/rbenv.git` uses the `git` protocol, which transmits data without encryption. Disable this warning with `bundle config git.allow_insecure true`, or switch to the `https` protocol to keep your data secure.
--- ERROR REPORT TEMPLATE -------------------------------------------------------
# Error Report

## Questions

Please fill out answers to these questions, it'll help us figure out
why things are going wrong.

- **What did you do?**

  I ran the command `/home/howard/.rbenv/versions/2.4.1/bin/bundle install`

- **What did you expect to happen?**

  I expected Bundler to...

- **What happened instead?**

  Instead, what happened was...

- **Have you tried any solutions posted on similar issues in our issue tracker, stack overflow, or google?**

  I tried...

- **Have you read our issues document, https://github.com/bundler/bundler/blob/master/doc/contributing/ISSUES.md?**

  ...

## Backtrace

```
ArgumentError: Invalid source: nil
  /home/howard/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/source_list.rb:107:in `source_list_for'
  /home/howard/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/source_list.rb:56:in `get'
  /home/howard/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/definition.rb:746:in `block in converge_locked_specs'
  /home/howard/.rbenv/versions/2.4.1/lib/ruby/2.4.0/forwardable.rb:229:in `each'
  /home/howard/.rbenv/versions/2.4.1/lib/ruby/2.4.0/forwardable.rb:229:in `each'
  /home/howard/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/definition.rb:743:in `converge_locked_specs'
  /home/howard/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/definition.rb:228:in `resolve'
  /home/howard/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/definition.rb:159:in `specs'
  /home/howard/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/definition.rb:147:in `resolve_remotely!'
  /home/howard/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/installer.rb:226:in `resolve_if_need'
  /home/howard/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/installer.rb:78:in `run'
  /home/howard/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/installer.rb:24:in `install'
  /home/howard/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/cli/install.rb:68:in `run'
  /home/howard/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/cli.rb:191:in `block in install'
  /home/howard/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/settings.rb:92:in `temporary'
  /home/howard/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/cli.rb:190:in `install'
  /home/howard/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
  /home/howard/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
  /home/howard/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/vendor/thor/lib/thor.rb:369:in `dispatch'
  /home/howard/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/cli.rb:22:in `dispatch'
  /home/howard/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/vendor/thor/lib/thor/base.rb:444:in `start'
  /home/howard/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/cli.rb:13:in `start'
  /home/howard/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/exe/bundle:30:in `block in <top (required)>'
  /home/howard/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors'
  /home/howard/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.15.3/exe/bundle:22:in `<top (required)>'
  /home/howard/.rbenv/versions/2.4.1/bin/bundle:22:in `load'
  /home/howard/.rbenv/versions/2.4.1/bin/bundle:22:in `<main>'
```

## Environment

```
Bundler   1.15.3
Rubygems  2.6.11
Ruby      2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
GEM_HOME  /home/howard/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0
GEM_PATH  /home/howard/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0:/home/howard/.gem/ruby/2.4.0
Git       2.7.4
Platform  x86_64-linux
OpenSSL   OpenSSL 1.0.2g  1 Mar 2016
```

## Bundler settings

```
without
  Set for your local app (/home/howard/Downloads/telefon/code/.bundle/config): "development:test"
```

## Gemfile

### Gemfile

```ruby
source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.6'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

gem 'capistrano', '~> 3.1.0'
gem 'capistrano-bundler', '~> 1.1.2'
gem 'capistrano-rails', '~> 1.1.1'
gem 'json', github: 'flori/json', branch: 'v1.8'

# Add this if you're using rbenv
gem 'capistrano-rbenv', github: "capistrano/rbenv"

gem "browser"

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
# gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Unicorn as the app server
# gem 'unicorn'

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

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

group :development do
  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 2.0'

  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
end
```

### Gemfile.lock

```
GIT
  remote: git://github.com/capistrano/rbenv.git
  revision: e056efc0c361cc15b76ff961d6c5f65ed5e2c57e
  specs:
    capistrano-rbenv (2.0.4)
      capistrano (~> 3.1)
      sshkit (~> 1.3)

GEM
  remote: https://rubygems.org/
  specs:'
    actionmailer (4.2.6)
      actionpack (= 4.2.6)
      actionview (= 4.2.6)
      activejob (= 4.2.6)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 1.0, >= 1.0.5)
    actionpack (4.2.6)
      actionview (= 4.2.6)
      activesupport (= 4.2.6)
      rack (~> 1.6)
      rack-test (~> 0.6.2)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    actionview (4.2.6)
      activesupport (= 4.2.6)
      builder (~> 3.1)
      erubis (~> 2.7.0)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    activejob (4.2.6)
      activesupport (= 4.2.6)
      globalid (>= 0.3.0)
    activemodel (4.2.6)
      activesupport (= 4.2.6)
      builder (~> 3.1)
    activerecord (4.2.6)
      activemodel (= 4.2.6)
      activesupport (= 4.2.6)
      arel (~> 6.0)
    activesupport (4.2.6)
      i18n (~> 0.7)
      json (~> 1.7, >= 1.7.7)
      minitest (~> 5.1)
      thread_safe (~> 0.3, >= 0.3.4)
      tzinfo (~> 1.1)
    arel (6.0.3)
    binding_of_caller (0.7.2)
      debug_inspector (>= 0.0.1)
    browser (2.1.0)
    builder (3.2.2)
    byebug (9.0.5)
    capistrano (3.1.0)
      i18n
      rake (>= 10.0.0)
      sshkit (~> 1.3)
    capistrano-bundler (1.1.4)
      capistrano (~> 3.1)
      sshkit (~> 1.2)
    capistrano-rails (1.1.7)
      capistrano (~> 3.1)
      capistrano-bundler (~> 1.1)
    coffee-rails (4.1.1)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0, < 5.1.x)
    coffee-script (2.4.1)
      coffee-script-source
      execjs
    coffee-script-source (1.10.0)
    concurrent-ruby (1.0.2)
    debug_inspector (0.0.2)
    erubis (2.7.0)
    execjs (2.7.0)
    globalid (0.3.6)
      activesupport (>= 4.1.0)
    i18n (0.7.0)
    jbuilder (2.5.0)
      activesupport (>= 3.0.0, < 5.1)
      multi_json (~> 1.2)
    jquery-rails (4.1.1)
      rails-dom-testing (>= 1, < 3)
      railties (>= 4.2.0)
      thor (>= 0.14, < 2.0)
    loofah (2.0.3)
      nokogiri (>= 1.5.9)
    mail (2.6.4)
      mime-types (>= 1.16, < 4)
    mime-types (3.1)
      mime-types-data (~> 3.2015)
    mime-types-data (3.2016.0521)
    mini_portile2 (2.1.0)
    minitest (5.9.0)
    multi_json (1.12.1)
    net-scp (1.2.1)
      net-ssh (>= 2.6.5)
    net-ssh (3.1.1)
    nokogiri (1.6.8)
      mini_portile2 (~> 2.1.0)
      pkg-config (~> 1.1.7)
    pkg-config (1.1.7)
    rack (1.6.4)
    rack-test (0.6.3)
      rack (>= 1.0)
    rails (4.2.6)
      actionmailer (= 4.2.6)
      actionpack (= 4.2.6)
      actionview (= 4.2.6)
      activejob (= 4.2.6)
      activemodel (= 4.2.6)
      activerecord (= 4.2.6)
      activesupport (= 4.2.6)
      bundler (>= 1.3.0, < 2.0)
      railties (= 4.2.6)
      sprockets-rails
    rails-deprecated_sanitizer (1.0.3)
      activesupport (>= 4.2.0.alpha)
    rails-dom-testing (1.0.7)
      activesupport (>= 4.2.0.beta, < 5.0)
      nokogiri (~> 1.6.0)
      rails-deprecated_sanitizer (>= 1.0.1)
    rails-html-sanitizer (1.0.3)
      loofah (~> 2.0)
    railties (4.2.6)
      actionpack (= 4.2.6)
      activesupport (= 4.2.6)
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (11.2.2)
    rdoc (4.2.2)
      json (~> 1.4)
    sass (3.4.22)
    sass-rails (5.0.4)
      railties (>= 4.0.0, < 5.0)
      sass (~> 3.1)
      sprockets (>= 2.8, < 4.0)
      sprockets-rails (>= 2.0, < 4.0)
      tilt (>= 1.1, < 3)
    sdoc (0.4.1)
      json (~> 1.7, >= 1.7.7)
      rdoc (~> 4.0)
    spring (1.7.1)
    sprockets (3.6.0)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.0.4)
      actionpack (>= 4.0)
      activesupport (>= 4.0)
      sprockets (>= 3.0.0)
    sqlite3 (1.3.11)
    sshkit (1.11.1)
      net-scp (>= 1.1.2)
      net-ssh (>= 2.8.0)
    thor (0.19.1)
    thread_safe (0.3.5)
    tilt (2.0.5)
    tzinfo (1.2.2)
      thread_safe (~> 0.1)
    uglifier (3.0.0)
      execjs (>= 0.3.0, < 3)
    web-console (2.3.0)
      activemodel (>= 4.0)
      binding_of_caller (>= 0.7.2)
      railties (>= 4.0)
      sprockets-rails (>= 2.0, < 4.0)

PLATFORMS
  ruby

DEPENDENCIES
  browser
  byebug
  capistrano (~> 3.1.0)
  capistrano-bundler (~> 1.1.2)
  capistrano-rails (~> 1.1.1)
  capistrano-rbenv!
  coffee-rails (~> 4.1.0)
  jbuilder (~> 2.0)
  jquery-rails
  rails (= 4.2.6)
  sass-rails (~> 5.0)
  sdoc (~> 0.4.0)
  spring
  sqlite3
  uglifier (>= 1.3.0)
  web-console (~> 2.0)

BUNDLED WITH
   1.12.5
```

--- TEMPLATE END ----------------------------------------------------------------

Unfortunately, an unexpected error occurred, and Bundler cannot continue.

First, try this link to see if there are any existing issue reports for this error:
https://github.com/bundler/bundler/search?q=Invalid+source++nil&type=Issues

If there aren't any reports for this error yet, please create copy and paste the report template above into a new issue. Don't forget to anonymize any private data! The new issue form is located at:
https://github.com/bundler/bundler/issues/new

Does anybody know what i could try to get out of this situation?

有人知道我可以尝试摆脱这种情况吗?

Thanks

1 个解决方案

#1


0  

If you need to remove a gem you should remove it from your Gemfile, not Gemfile.lock.

如果你需要删除一个gem,你应该从你的Gemfile中删除它,而不是Gemfile.lock。

In your Gemfile: gem 'json', github: 'flori/json', branch: 'v1.8'

在你的Gemfile中:gem'json',github:'flori / json',分支:'v1.8'

bundler creates Gemfile.lock for you after it resolves your dependencies during bundle install, based on whatever's in your Gemfile. Gemfile.lock also specifies gems that are not in your Gemfile but are dependencies of gems that are. Editing it manually is almost guaranteed to cause you problems and fix nothing.

在根据Gemfile中的内容解析捆绑安装期间的依赖关系后,bundler会为您创建Gemfile.lock。 Gemfile.lock还指定了Gemfile中不存在的gems,但它们是gems的依赖项。手动编辑几乎可以保证您遇到问题并且无需任何修复。

But you probably don't need to remove it at all. Right now you're locked onto a version of json that bundler's having trouble resolving. You should delete Gemfile.lock and let bundler generate a brand new one.

但你可能根本不需要删除它。现在你被锁定了一个版本的json,捆绑包无法解析。您应该删除Gemfile.lock并让bundler生成一个全新的。

#1


0  

If you need to remove a gem you should remove it from your Gemfile, not Gemfile.lock.

如果你需要删除一个gem,你应该从你的Gemfile中删除它,而不是Gemfile.lock。

In your Gemfile: gem 'json', github: 'flori/json', branch: 'v1.8'

在你的Gemfile中:gem'json',github:'flori / json',分支:'v1.8'

bundler creates Gemfile.lock for you after it resolves your dependencies during bundle install, based on whatever's in your Gemfile. Gemfile.lock also specifies gems that are not in your Gemfile but are dependencies of gems that are. Editing it manually is almost guaranteed to cause you problems and fix nothing.

在根据Gemfile中的内容解析捆绑安装期间的依赖关系后,bundler会为您创建Gemfile.lock。 Gemfile.lock还指定了Gemfile中不存在的gems,但它们是gems的依赖项。手动编辑几乎可以保证您遇到问题并且无需任何修复。

But you probably don't need to remove it at all. Right now you're locked onto a version of json that bundler's having trouble resolving. You should delete Gemfile.lock and let bundler generate a brand new one.

但你可能根本不需要删除它。现在你被锁定了一个版本的json,捆绑包无法解析。您应该删除Gemfile.lock并让bundler生成一个全新的。