我是新来的Rails,请耐心等待。ActiveRecord :: PendingMigrationError - 从一台服务器迁移到另一台服务器
目前在数字海洋虚拟机(Ubuntu 14.04)上运行的现有项目(Rails 4.1.6,Ruby 2.1.3)及其与Postgresdb 9.6的连接没有任何问题。我必须将其迁移到新的VM。
我已经在Ubuntu 16.04上安装了一个新的虚拟机,安装了完全相同版本的Rails和Ruby。我试图创建一个测试轨应用程序,它的工作正常。但是,当我试图从旧服务器部署项目到这个新的它给我错误。
Details:
There was an error while trying to load the gem 'uglifier'.
Gem Load Error is: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes.
Backtrace for gem load error is:
/usr/local/lib/ruby/gems/2.1.0/gems/execjs-2.7.0/lib/execjs /runtimes.rb:58:in `autodetect'
/usr/local/lib/ruby/gems/2.1.0/gems/execjs-2.7.0/lib/execjs.rb:5:in `<module:ExecJS>'
/usr/local/lib/ruby/gems/2.1.0/gems/execjs-2.7.0/lib/execjs.rb:4:in `<top (required)>'
/usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.6/lib /active_support/dependencies.rb:247:in `require'
/usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `block in require'
/usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:232:in `load_dependency'
互联网上搜索后,他们大多建议取消注释中的Gemfile此行。
# gem 'therubyracer', platforms: :ruby
这是在旧的服务器上评论,但是,我试图取消注释它,它回来了不同的错误。
Migrations are pending. To resolve this issue, run: bin/rake db:migrate RAILS_ENV=development
网站连接到相同的数据库和旧的webportal运行良好,但它给了我这个错误。所以,我建立一个新的测试数据库和运行以下命令 -
RAILS_ENV=production bundle exec rake db:create
RAILS_ENV=production bundle exec rake db:setup
RAILS_ENV=production bundle exec rake db:migrate
所有这些命令成功执行,但由于某种原因,我仍然收到“迁移正在等待......”的错误。
请指教。
当您说“运行测试”时,您的意思是rspec测试还是其他自动测试? –
迁移错误似乎认为您应该在'development'环境中......但是您所运行的迁移是针对'production' ......因此,无论您的环境设置不正确,还是需要运行迁移为'发展'而不是 –
@Taryn东谢谢..我真是太愚蠢了。我检查了nginx站点可用的文件,并且乘客env被设置为开发。我改变了它的生产,它像一个魅力。 – Sai