Ruby on rails 从RubyonRails 4.2.7.1升级到5.0.1——仍然尝试使用railties 4.2.7.1

Ruby on rails 从RubyonRails 4.2.7.1升级到5.0.1——仍然尝试使用railties 4.2.7.1,ruby-on-rails,ruby,upgrade,ruby-on-rails-5,rails-4-upgrade,Ruby On Rails,Ruby,Upgrade,Ruby On Rails 5,Rails 4 Upgrade,我正在创建一个网站,但无意中安装了RubyonRails版本4而不是版本5,并且希望升级到最新版本,以便使用我系统上现有版本中缺少的一些功能 我试着遵循这个指南: 我安装了rvm,并按顺序运行了所有准备工作,直到本节: rvm use ruby-2.3.1@rails5.0 --create gem install rails rails -v 在那里我遇到了问题rvm使用ruby-2.3。1@rails5.0--创建输出: ruby-2.3.1 - #gemset created /hom

我正在创建一个网站,但无意中安装了RubyonRails版本4而不是版本5,并且希望升级到最新版本,以便使用我系统上现有版本中缺少的一些功能

我试着遵循这个指南:

我安装了
rvm
,并按顺序运行了所有准备工作,直到本节:

rvm use ruby-2.3.1@rails5.0 --create
gem install rails
rails -v
在那里我遇到了问题<代码>rvm使用ruby-2.3。1@rails5.0--创建输出:

ruby-2.3.1 - #gemset created /home/dev/.rvm/gems/ruby-2.3.1@rails5.0
ruby-2.3.1 - #generating rails5.0 wrappers..........
Using /home/dev/.rvm/gems/ruby-2.3.1 with gemset rails5.0
好的
Gem安装rails
也会毫无错误地进行,安装所有36个Gem,关键是:

Fetching: rails-5.0.1.gem (100%)
Successfully installed rails-5.0.1

但是,当我直接在后面运行
rails-v
时,我得到:

Could not find proper version of railties (4.2.7.1) in any of the sources  
Run `bundle install` to install missing gems.
但是,当我运行bundle install时,系统将恢复为rails 4.2.7.1


我是否需要做一些额外的事情来安装/link/whatever railties 4.2.7.1,并阻止系统恢复到rails的原始版本?我不太使用rails,所以我对配置不是特别熟悉。也许我需要更改应用程序中的配置文件?

问题出在包含旧版本号的GEM文件中。我更新了以下内容:

source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '5.0.1'
# Use mysql as the database for Active Record
gem 'mysql2', '>= 0.3.13', '< 0.5'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0.6'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 3.0.4'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2.1'
# 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.4.1'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.1', 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
源代码'https://rubygems.org'
#捆绑边缘Rails:gem'Rails',github'Rails/Rails'
gem“rails”、“5.0.1”
#使用mysql作为活动记录的数据库
gem'mysql2','>=0.3.13','<0.5'
#将SCS用于样式表
gem'sass-rails',“~>5.0.6”
#使用Uglifier作为JavaScript资产的压缩器
gem'uglifier','>=3.0.4'
#将CoffeeScript用于.coffee资产和视图
gem“咖啡轨”,“~>4.2.1”
#看https://github.com/rails/execjs#readme 获取更多受支持的运行时
#宝石“therubyracer”,平台::ruby
#使用jquery作为JavaScript库
gem'jqueryrails'
#Turbolinks使web应用程序中的以下链接更快。阅读更多:https://github.com/rails/turbolinks
gem“涡轮链接”
#轻松构建JSON API。阅读更多:https://github.com/rails/jbuilder
gem'jbuilder',“~>2.4.1”
#bundle exec rake doc:rails在doc/API下生成API。
gem'sdoc','~>0.4.1',组::doc
#使用ActiveModel具有\u安全\u密码
gem'bcrypt',“~>3.1.7”
#使用Unicorn作为应用程序服务器
#宝石“独角兽”
#使用Capistrano进行部署
gem“capistrano rails”,集团::开发
小组:开发,:测试
#在代码中的任意位置调用“byebug”以停止执行并获得调试器控制台
宝石“比伯”
结束
小组:发展怎么办
#在异常页面上或通过在视图中使用访问IRB控制台
gem“web控制台”,“~>2.0”
#Spring通过让应用程序在后台运行来加速开发。阅读更多:https://github.com/rails/spring
宝石“春天”
结束

然后运行
bundle update
,然后运行
bundle install
,现在有了Rails 5.0.1。感谢Iceman建议查看Gemfile

问题出在包含旧版本号的GEM文件中。我更新了以下内容:

source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '5.0.1'
# Use mysql as the database for Active Record
gem 'mysql2', '>= 0.3.13', '< 0.5'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0.6'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 3.0.4'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2.1'
# 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.4.1'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.1', 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
源代码'https://rubygems.org'
#捆绑边缘Rails:gem'Rails',github'Rails/Rails'
gem“rails”、“5.0.1”
#使用mysql作为活动记录的数据库
gem'mysql2','>=0.3.13','<0.5'
#将SCS用于样式表
gem'sass-rails',“~>5.0.6”
#使用Uglifier作为JavaScript资产的压缩器
gem'uglifier','>=3.0.4'
#将CoffeeScript用于.coffee资产和视图
gem“咖啡轨”,“~>4.2.1”
#看https://github.com/rails/execjs#readme 获取更多受支持的运行时
#宝石“therubyracer”,平台::ruby
#使用jquery作为JavaScript库
gem'jqueryrails'
#Turbolinks使web应用程序中的以下链接更快。阅读更多:https://github.com/rails/turbolinks
gem“涡轮链接”
#轻松构建JSON API。阅读更多:https://github.com/rails/jbuilder
gem'jbuilder',“~>2.4.1”
#bundle exec rake doc:rails在doc/API下生成API。
gem'sdoc','~>0.4.1',组::doc
#使用ActiveModel具有\u安全\u密码
gem'bcrypt',“~>3.1.7”
#使用Unicorn作为应用程序服务器
#宝石“独角兽”
#使用Capistrano进行部署
gem“capistrano rails”,集团::开发
小组:开发,:测试
#在代码中的任意位置调用“byebug”以停止执行并获得调试器控制台
宝石“比伯”
结束
小组:发展怎么办
#在异常页面上或通过在视图中使用访问IRB控制台
gem“web控制台”,“~>2.0”
#Spring通过让应用程序在后台运行来加速开发。阅读更多:https://github.com/rails/spring
宝石“春天”
结束

然后运行
bundle update
,然后运行
bundle install
,现在有了Rails 5.0.1。感谢Iceman建议查看Gemfile

你的
档案中有什么?@Iceman啊哈!我想我已经发现问题了!谢谢…你的
档案中有什么?@Iceman啊哈!我想我已经发现问题了!谢谢