每次我尝试将Rails应用程序部署到Google App Engine时,都会收到“错误响应[9],找不到命令:rails s”。我遵循了Google的文档,将Rails应用程序部署到Googles App Engine,一切似乎都工作到“更新服务”,然后几分钟后失败,并给我九个错误响应,表示未找到Rails服务器命令,我应该运行捆绑安装以安装缺少的gem(我在App Engine控制台中尝试过)
这是我的app.yml文件
runtime: ruby
env: flex
entrypoint: rails server
env_variables:
SECRET_KEY_BASE: XXXXXXXXXXX
skip_files:
- ^(.*/)?#.*#$
- ^(.*/)?.*~$
- ^(.*/)?.*\.py[co]$
- ^(.*/)?.*/RCS/.*$
- ^(.*/)?\..*$
- ^(.*/)?.*\.lock$
- public/uploads
通常,我花了几天时间搜索Stack Overflow和Internet,试图解决此问题,但是我尝试的所有操作均产生了相同的错误。有人对我如何解决有任何提示吗?或者,如果您认为与解决类似问题的人有帮助链接,那也很酷。谢谢您的宝贵时间。
编辑:我可以使用rails rack up和rails服务器在本地运行一切正常,我只有在部署到Google Cloud时才找不到命令。
这是我的整个宝石文件
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use Puma as the app server
gem 'puma', '~> 3.11'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.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'
gem 'rack'
gem 'will_paginate', '~> 3.1.0'
gem 'layzr-rails'
# Use ActiveStorage variant
# gem 'mini_magick', '~> 4.8'
# 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
gem 'carrierwave','~> 1.0'
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'
gem 'faker'
end
group :test do
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '>= 2.15', '< 4.0'
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]
# Added at 2018-06-20 10:57:17 -0700 by desktop-2stoub1\zoomd:
gem "dotenv-rails", "~> 2.4"
这是我从日志中获取的错误堆栈跟踪信息(仅显示的内容是基本上找不到命令)
2018-07-17 18:58:36默认[20180717t115001]捆绑器:找不到命令:rails
2018-07-17 18:58:36默认[20180717t115001]使用bundle install
编辑:找到发生问题的地方
步骤1:捆绑程序:无法加载命令:耙(/opt/rbenv/versions/2.3.7/bin/rake)
步骤#1:[91mBundler :: GemNotFound:在Gemfile中列出的任何gem来源中找不到gem'rails(〜> 5.2.0)'。
步骤#1:/ block in verify_gemfile_dependencies_are_found!'
Step #1: /opt/rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/bundler-1.16.2/lib/bundler/resolver.rb:257:in
中的/opt/rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/bundler-1.16.2/lib/bundler/resolver.rb:289: '
步骤#1:/ verify_gemfile_dependencies_are_found!'
Step #1: /opt/rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/bundler-1.16.2/lib/bundler/resolver.rb:48:in
中的/opt/rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/bundler-1.16.2/lib/bundler/resolver.rb:257:start '
步骤#1:/opt/rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/bundler-1.16.2/lib/bundler/resolver.rb:22:in resolve'
Step #1: /opt/rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/bundler-1.16.2/lib/bundler/definition.rb:258:in
中'
步骤#1:/opt/rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/bundler-1.16.2/lib/bundler/definition.rb:171:in specs'
Step #1: /opt/rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/bundler-1.16.2/lib/bundler/definition.rb:238:in
specs_for '
步骤#1:/opt/rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/bundler-1.16.2/lib/bundler/definition.rb:227:in requested_specs'
Step #1: /opt/rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:108:in
block在definition_method中
步骤#1:/opt/rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/bundler-1.16.2/lib/bundler/runtime.rb:20:在setup'
Step #1: /opt/rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/bundler-1.16.2/lib/bundler.rb:107:in
设置中'
步骤#1:/ {/ {1}}中的/opt/rbenv/versions/2.3.7/lib/ruby/gems/2.3.0/gems/bundler-1.16.2/lib/bundler/setup.rb:20:require '
步骤#1:/opt/rbenv/versions/2.3.7/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in`require'[0m [91m
由于某种原因,似乎没有任何宝石可以从rubygems来源加载。它确实在本地工作,我只会在部署时收到此错误。 gcloud是否需要其他来源的宝石?