我有一个Heroku app / RoR服务器集。尝试运行命令时
bundle exec rake db:create db:migrate
我得到LoadError: cannot load such file -- 2.1/pg_ext
?
我在我的gemfile中有这个:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.8'
# Use postgresql as the database for Active Record
gem 'pg'
gem 'rails_12factor', group: :production
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# 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'
# 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', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', group: :development
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
gem 'puma'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
不知道我哪里错了......
我认为我错了,因为我没有正确设置SET DATABASE_URL=postgres:///$(whoami)
,这个命令的格式是什么?
现在尝试了一些事后我得到了一个不同的错误:
rake aborted! PG::ConnectionBad: fe_sendauth: no password provided
我必须在哪里提供此密码?
答案 0 :(得分:1)
我在Heroku和SQLite上使用PostgreSQL进行本地开发。如果您依赖某些Postgres特定功能,那么可能不是您的情况。否则它就足够了。
这是我的Gemfile中的一部分:
# Use sqlite3 as the database for Active Record
gem 'sqlite3', group: :development
# Deploy on Heroku
gem 'pg', group: :production
gem 'rails_12factor', group: :production
答案 1 :(得分:0)
您已将此列为您运行的生成错误的命令。这不是有效的命令行:
bundle exec rake db:create db:migrate
这是两个不连续的动作。要创建数据库,请首先以:
开头bundle exec rake db:create
在对数据库的后续更新中使用:
bundle exec rake db:migrate