NameError:未初始化的常数Bundler [英] NameError: uninitialized constant Bundler

查看:118
本文介绍了NameError:未初始化的常数Bundler的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是将Web服务器更改为Puma,并且不得不将开发数据库从sqlite更改为postgresql。但现在每次尝试运行 rake db:migrate时,都会出现此错误:

I just changed my webserver to Puma and had to change my development DB from sqlite to postgresql. but now I'm getting this error everytime I try to run '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)

我的gemfile:

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 可以成功迁移我的数据库。

running bundle exec rake db:migrate works and successfully migrates my db.

推荐答案

安装捆绑器 gem:

gem install bundler

然后,再试一次。

如果上述方法无效,请尝试:

If the above does not work, try:

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

然后再试一次。

如果这不起作用,您可以尝试删除 Gemfile.lock 而不是建议(但如果您只是开始您的项目,并且没有人在他们的计算机中拥有 Gemfile.lock ,则可以这样做):

If this does not work, you may try removing Gemfile.lock which is not recommended (but if you are just starting your project and no one else is having Gemfile.lock in their machine, you can do this):

rm -rf Gemfile.lock

这篇关于NameError:未初始化的常数Bundler的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆