gcloud部署错误“Ruby版本是2.3.3,但你的Gemfile指定为2.4.1”,尽管我的版本是2.4.1

时间:2017-05-06 05:02:24

标签: ruby-on-rails ruby google-app-engine google-cloud-platform google-cloud-storage

在尝试成功发布其中一个测试应用程序之后,我第一次尝试部署GAE项目,而且我收到错误的ruby版本错误。我不确定它是否是其他宝石之一,但我不熟悉ROR或GCS,我不知道还能做什么。 感谢。

以下是我的一些系统设置:

$ ruby -v
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin14]


$ rvm list
rvm rubies

 * ruby-2.4.0 [ x86_64 ]
=> ruby-2.4.1 [ x86_64 ]

$ rails -v
Rails 5.0.2

宝石文件:

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '5.0.2'
ruby "2.4.1"

# Use sqlite3 as the database for Active Record
# gem 'sqlite3'

# Use SCSS for stylesheets
gem 'sass-rails', '>= 5.0.0.beta1'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'

# Use CoffeeScript for .js.coffee assets and views
#gem 'coffee-rails', '~> 4.0.0'
gem 'coffee-rails', '~> 4.2.1'

# See https://github.com/sstephenson/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', '~> 1.2'

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end

group :production do
  gem "mysql2", "~> 0.3.0"
end

group :development, :test do
  gem "sqlite3"
end



gem "rack"
gem "puma"

1 个答案:

答案 0 :(得分:2)

默认解释器目前是Ruby 2.3.3。您可以通过将版本名称写入应用程序目录中的.ruby-version文件来指定不同的Ruby版本。例如:

2.2.5

当存在.ruby-version文件时,运行时会尝试下载并安装指定版本的Ruby。如果无法满足版本,则在部署应用程序时将收到错误消息。

文档:https://cloud.google.com/appengine/docs/flexible/ruby/runtime