Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 将rails应用程序部署到heroku时出错,捆绑包错误_Ruby On Rails_Heroku_Rubygems - Fatal编程技术网

Ruby on rails 将rails应用程序部署到heroku时出错,捆绑包错误

Ruby on rails 将rails应用程序部署到heroku时出错,捆绑包错误,ruby-on-rails,heroku,rubygems,Ruby On Rails,Heroku,Rubygems,在运行命令git push heroku master时,我得到了错误: remote: Downloading nokogiri-1.8.2 revealed dependencies not in the API or the lockfile remote: (mini_portile2 (~> 2.3.0)). remote: Either installing with `--full-index` or running `bundle

在运行命令
git push heroku master
时,我得到了错误:

remote:        Downloading nokogiri-1.8.2 revealed dependencies not in the API or the lockfile
remote:        (mini_portile2 (~> 2.3.0)).
remote:        Either installing with `--full-index` or running `bundle update nokogiri` should
remote:        fix the problem.
remote: 
remote:  !
remote:  !     Failed to install gems via Bundler.
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected to fathomless-journey-80413.
remote: 
我偶然发现了这一页 建议采取以下步骤:

  • 在您的文件中,更改:

    宝石“pg”

    gem'pg',“~>0.20.0”

  • 删除名为Gemfile.lock的文件

  • GEM
      remote: https://rubygems.org/
      specs:
        actionmailer (4.2.10)
          actionpack (= 4.2.10)
          actionview (= 4.2.10)
          activejob (= 4.2.10)
          mail (~> 2.5, >= 2.5.4)
          rails-dom-testing (~> 1.0, >= 1.0.5)
        actionpack (4.2.10)
          actionview (= 4.2.10)
          activesupport (= 4.2.10)
          rack (~> 1.6)
          rack-test (~> 0.7.0)
          rails-dom-testing (~> 1.0, >= 1.0.5)
          rails-html-sanitizer (~> 1.0, >= 1.0.2)
        actionview (4.2.10)
          activesupport (= 4.2.10)
          builder (~> 3.1)
          erubis (~> 2.7.0)
          rails-dom-testing (~> 1.0, >= 1.0.5)
          rails-html-sanitizer (~> 1.0, >= 1.0.3)
        activejob (4.2.10)
          activesupport (= 4.2.10)
          globalid (>= 0.3.0)
        activemodel (4.2.10)
          activesupport (= 4.2.10)
          builder (~> 3.1)
        activerecord (4.2.10)
          activemodel (= 4.2.10)
          activesupport (= 4.2.10)
          arel (~> 6.0)
        activesupport (4.2.10)
          i18n (~> 0.7)
          minitest (~> 5.1)
          thread_safe (~> 0.3, >= 0.3.4)
          tzinfo (~> 1.1)
        arel (6.0.4)
        binding_of_caller (0.8.0)
          debug_inspector (>= 0.0.1)
        builder (3.2.4)
        byebug (11.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.12.2)
        concurrent-ruby (1.1.6)
        crass (1.0.6)
        debug_inspector (0.0.3)
        erubis (2.7.0)
        execjs (2.7.0)
        ffi (1.12.2)
        globalid (0.4.2)
          activesupport (>= 4.2.0)
        i18n (0.9.5)
          concurrent-ruby (~> 1.0)
        jbuilder (2.9.1)
          activesupport (>= 4.2.0)
        jquery-rails (4.3.5)
          rails-dom-testing (>= 1, < 3)
          railties (>= 4.2.0)
          thor (>= 0.14, < 2.0)
        loofah (2.5.0)
          crass (~> 1.0.2)
          nokogiri (>= 1.5.9)
        mail (2.7.1)
          mini_mime (>= 0.1.1)
        mini_mime (1.0.2)
        mini_portile2 (2.4.0)
        minitest (5.14.0)
        nokogiri (1.10.9)
          mini_portile2 (~> 2.4.0)
        pg (0.20.0)
        rack (1.6.13)
        rack-test (0.7.0)
          rack (>= 1.0, < 3)
        rails (4.2.10)
          actionmailer (= 4.2.10)
          actionpack (= 4.2.10)
          actionview (= 4.2.10)
          activejob (= 4.2.10)
          activemodel (= 4.2.10)
          activerecord (= 4.2.10)
          activesupport (= 4.2.10)
          bundler (>= 1.3.0, < 2.0)
          railties (= 4.2.10)
          sprockets-rails
        rails-deprecated_sanitizer (1.0.3)
          activesupport (>= 4.2.0.alpha)
        rails-dom-testing (1.0.9)
          activesupport (>= 4.2.0, < 5.0)
          nokogiri (~> 1.6)
          rails-deprecated_sanitizer (>= 1.0.1)
        rails-html-sanitizer (1.3.0)
          loofah (~> 2.3)
        railties (4.2.10)
          actionpack (= 4.2.10)
          activesupport (= 4.2.10)
          rake (>= 0.8.7)
          thor (>= 0.18.1, < 2.0)
        rake (13.0.1)
        rb-fsevent (0.10.3)
        rb-inotify (0.10.1)
          ffi (~> 1.0)
        rdoc (6.2.1)
        sass (3.7.4)
          sass-listen (~> 4.0.0)
        sass-listen (4.0.0)
          rb-fsevent (~> 0.9, >= 0.9.4)
          rb-inotify (~> 0.9, >= 0.9.7)
        sass-rails (5.0.7)
          railties (>= 4.0.0, < 6)
          sass (~> 3.1)
          sprockets (>= 2.8, < 4.0)
          sprockets-rails (>= 2.0, < 4.0)
          tilt (>= 1.1, < 3)
        sdoc (1.1.0)
          rdoc (>= 5.0)
        spring (2.1.0)
        sprockets (3.7.2)
          concurrent-ruby (~> 1.0)
          rack (> 1, < 3)
        sprockets-rails (3.2.1)
          actionpack (>= 4.0)
          activesupport (>= 4.0)
          sprockets (>= 3.0.0)
        thor (1.0.1)
        thread_safe (0.3.6)
        tilt (2.0.10)
        turbolinks (5.2.1)
          turbolinks-source (~> 5.2)
        turbolinks-source (5.2.0)
        tzinfo (1.2.7)
          thread_safe (~> 0.1)
        uglifier (4.2.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
      byebug
      coffee-rails (~> 4.1.0)
      jbuilder (~> 2.0)
      jquery-rails
      pg (~> 0.20.0)
      rails (= 4.2.10)
      sass-rails (~> 5.0)
      sdoc (>= 0.4.0)
      spring
      turbolinks
      uglifier (>= 1.3.0)
      web-console (~> 2.0)
    
    BUNDLED WITH
       1.16.1
    
  • 运行bundle安装--无需生产
  • 运行git commit-am“将版本添加到pg”
  • 运行git push Heroku master
以上步骤解决了我的问题,但现在我又遇到了类似的错误

remote:        Downloading actionpack-4.2.10 revealed dependencies not in the API or the
remote:        lockfile (rack-test (~> 0.6.2)).
remote:        Either installing with `--full-index` or running `bundle update actionpack`
remote:        should fix the problem.
remote: 
remote:  !
remote:  !     Failed to install gems via Bundler.
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !   Push rejected to fathomless-journey-80413.
remote: 
我的档案:

source 'https://rubygems.org'




# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.10'
# Use sqlite3 as the database for Active Record
#gem 'sqlite3'
#gem 'pg'
gem 'pg', '~> 0.20.0'
# 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

# 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
编辑:我认为故障是由于通过apt get安装ruby造成的,所以我删除了它,用rvm重新安装了ruby,结果成功了!!!!!
感谢您的建议。

您是否按照错误消息运行了
捆绑更新actionpack
?是的,但它说“捆绑程序试图更新actionpack,但其版本保持不变”,我在发布的原始错误中看到
捆绑更新nokogiri
?你在本地运行过这个命令吗?发生了什么?“bundle update nokogiri”刚刚尝试更新gem。由于它已经更新,我收到了“Bundler试图更新nokogiri,但其版本保持不变”的消息。我尝试了许多命令
bundle install
bundle update
,安装了mini_portile2-2.3.0,卸载后重新安装Bundler,重新安装nokogiri。最后,上面列出的解决方案对我有效,但现在我被actionpackDid卡住了。您是否按照错误消息运行
bundle update actionpack
?是的,但它说“Bundler试图更新actionpack,但其版本保持不变”,我在发布的原始错误中看到
bundle update nokogiri
?你在本地运行过这个命令吗?发生了什么?“bundle update nokogiri”刚刚尝试更新gem。由于它已经更新,我收到了“Bundler试图更新nokogiri,但其版本保持不变”的消息。我尝试了许多命令
bundle install
bundle update
,安装了mini_portile2-2.3.0,卸载后重新安装Bundler,重新安装nokogiri。最后,上面列出的解决方案对我有效,但现在我只能使用actionpack
Fetching gem metadata from https://rubygems.org/.............
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies....
Using rake 13.0.1
Using concurrent-ruby 1.1.6
Using i18n 0.9.5
Using minitest 5.14.0
Using thread_safe 0.3.6
Using tzinfo 1.2.7
Using activesupport 4.2.10
Using builder 3.2.4
Using erubis 2.7.0
Using mini_portile2 2.4.0
Using nokogiri 1.10.9
Using rails-deprecated_sanitizer 1.0.3
Using rails-dom-testing 1.0.9
Using crass 1.0.6
Using loofah 2.5.0
Using rails-html-sanitizer 1.3.0
Using actionview 4.2.10
Using rack 1.6.13
Using rack-test 0.7.0
Using actionpack 4.2.10
Using globalid 0.4.2
Using activejob 4.2.10
Using mini_mime 1.0.2
Using mail 2.7.1
Using actionmailer 4.2.10
Using activemodel 4.2.10
Using arel 6.0.4
Using activerecord 4.2.10
Using debug_inspector 0.0.3
Using binding_of_caller 0.8.0
Using bundler 1.16.1
Using byebug 11.1.1
Using coffee-script-source 1.12.2
Using execjs 2.7.0
Using coffee-script 2.4.1
Using thor 1.0.1
Using railties 4.2.10
Using coffee-rails 4.1.1
Using ffi 1.12.2
Using jbuilder 2.9.1
Using jquery-rails 4.3.5
Using pg 0.20.0
Using sprockets 3.7.2
Using sprockets-rails 3.2.1
Using rails 4.2.10
Using rb-fsevent 0.10.3
Using rb-inotify 0.10.1
Using rdoc 6.2.1
Using sass-listen 4.0.0
Using sass 3.7.4
Using tilt 2.0.10
Using sass-rails 5.0.7
Using sdoc 1.1.0
Using spring 2.1.0
Using turbolinks-source 5.2.0
Using turbolinks 5.2.1
Using uglifier 4.2.0
Using web-console 2.3.0
Bundler attempted to update actionpack but its version stayed the same
Bundle updated!
Gems in the group production were not installed.