【问题标题】:NameError: uninitialized constant BundlerNameError:未初始化的常量捆绑器
【发布时间】:2015-09-07 17:48:31
【问题描述】:

我刚刚将我的网络服务器更改为 Puma,并且不得不将我的开发数据库从 sqlite 更改为 postgresql。但现在我每次尝试运行 'rake db:migrate' 时都会收到此错误:

rake aborted!
NameError: uninitialized constant Bundler
C:/Sites/dawnrebirth/config/application.rb:7:in <top (required)>'
C:/Sites/dawnrebirth/Rakefile:4:in <top (required)>'
(See full trace by running task with --trace)

我的宝石文件:

source 'https://rubygems.org'
gem 'rails', '4.2.1'
gem 'pg'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
group :development, :test do
  gem 'byebug'
  gem 'web-console', '~> 2.0'
  gem 'better_errors', '~> 2.1.1'
  gem 'annotate', '~> 2.6.10'
  gem 'binding_of_caller'
 end
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

gem 'devise', '~> 3.5.1'
gem 'haml', '~> 4.0.6'
gem 'sass', '~> 3.4.14'
gem 'paperclip', '~> 4.3.0'
gem 'babosa', '~> 1.0.2'
gem 'rails-i18n', '~> 4.0.4'
gem 'devise-i18n', '~> 0.12.1'
gem 'simple_form', '~> 3.1.0'
gem 'dotiw'
gem 'paperclip-dropbox', '~> 1.3.2'
gem 'rmagick', '~> 2.15.3', group: :production
gem 'masonry-rails', '~> 0.2.4'
gem 'rufus-scheduler', '~> 3.1.3'
gem 'jquery-turbolinks'
gem 'puma'
gem 'rails_12factor', group: :production
gem 'mailboxer'
gem 'acts_as_votable'

ruby "2.1.5"

编辑:

运行 bundle exec rake db:migrate 工作并成功迁移我的数据库。

【问题讨论】:

标签: ruby-on-rails ruby-on-rails-4 bundler


【解决方案1】:

安装bundler gem:

gem install bundler

然后,再试一次。

更新

如果上述方法不起作用,请尝试:

rm -rf .bundle/
rm -rf vendor/cache/

然后再试一次。

如果这不起作用,您可以尝试删除不推荐的Gemfile.lock(但如果您刚刚开始您的项目并且没有其他人在他们的机器中拥有Gemfile.lock,您可以这样做):

rm -rf Gemfile.lock

【讨论】:

  • 试试这个:rm -rf .bundle/ 然后bundle install
  • 你的项目在 github 上吗?
  • 不,我在 github 上没有
  • 如果不能在本地尝试,很难判断发生了什么。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-01-19
  • 2015-10-29
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多