Brew broken after doing brew update - homebrew

I'm trying to upgrade my Node. When doing brew update I got this:
$ brew update
==> Migrating Homebrew to v0.9.9
remote: Counting objects: 1027, done.
remote: Compressing objects: 100% (955/955), done.
remote: Total 1027 (delta 182), reused 346 (delta 43), pack-reused 0
Receiving objects: 100% (1027/1027), 1.18 MiB | 998 KiB/s, done.
Resolving deltas: 100% (182/182), completed with 95 local objects.
From https://github.com/Homebrew/brew
+ 5a9e19f...3fe3205 master -> origin/master (forced update)
* [new tag] 0.1 -> 0.1
HEAD is now at 3fe3205 Merge pull request #2775 from reitermarkus/language
To restore the stashed changes to /usr/local run:
'cd /usr/local && git stash pop'
==> Homebrew has enabled anonymous aggregate user behaviour analytics.
Read the analytics documentation (and how to opt-out) here:
http://docs.brew.sh/Analytics.html
==> Tapping homebrew/core
Cloning into '/usr/local/Library/Taps/homebrew/homebrew-core'...
remote: Counting objects: 4439, done.
remote: Compressing objects: 100% (4243/4243), done.
remote: Total 4439 (delta 35), reused 466 (delta 12), pack-reused 0
Receiving objects: 100% (4439/4439), 3.53 MiB | 812.00 KiB/s, done.
Resolving deltas: 100% (35/35), done.
Checking connectivity... done.
Tapped 4240 formulae (4,481 files, 11MB)
Already up-to-date.
==> Migrating HOMEBREW_REPOSITORY (please wait)...
Error: Failed to migrate HOMEBREW_REPOSITORY to /usr/local/Homebrew!
The error was:
Permission denied - /usr/local/lib/pkgconfig
Please try to resolve this error yourself and then run `brew update` again to
complete the migration. If you need help please +1 an existing error or comment
with your new error in issue:
https://github.com/Homebrew/brew/issues/987
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:245:in `mkdir'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:245:in `fu_mkdir'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:219:in `block (2 levels) in mkdir_p'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:217:in `reverse_each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:217:in `block in mkdir_p'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:203:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:203:in `mkdir_p'
/usr/local/Library/Homebrew/cmd/update-report.rb:268:in `block in migrate_legacy_repository_if_necessary'
/usr/local/Library/Homebrew/cmd/update-report.rb:267:in `each'
/usr/local/Library/Homebrew/cmd/update-report.rb:267:in `migrate_legacy_repository_if_necessary'
/usr/local/Library/Homebrew/cmd/update-report.rb:115:in `update_report'
/usr/local/Library/Homebrew/brew.rb:93:in `<main>'
Now, when I try to do brew, it can't find the command:
$ brew
-bash: /usr/local/bin/brew: No such file or directory
So I guess somehow brew got broken in the middle of the update. Any tips on how to fix this? Thank you.

To fix this, I just reinstalled Homebrew:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Related

Rails deployment on heroku failed. Rails couldn't infer whether you are using multiple databases from your database.yml

I was deploying my Rails application on Heroku and the deploy failed with this error message.
Rails couldn't infer whether you are using multiple databases from your database.yml and can't generate the tasks for the non-primary databases. If you'd like to use this feature, please simplify your ERB.
I have deployed continuously on Heroku for over a year and no major changes were made.
The change involved updating the gemfile from ruby '2.6.3' to ruby '3.1.2'.
Here is the full trace
Building on the Heroku-22 stack
Using buildpacks:
1. heroku/ruby
2. heroku/nodejs
Ruby app detected
Installing bundler 2.3.10
Removing BUNDLED WITH version in the Gemfile.lock
Compiling Ruby/Rails
###### WARNING:
Your app was upgraded to bundler 2.3.10.
Previously you had a successful deploy with bundler 2.2.21.
If you see problems related to the bundler version please refer to:
https://devcenter.heroku.com/articles/bundler-version#known-upgrade-issues
Using Ruby version: ruby-3.1.2
Purging Cache. Changing stack from heroku-18 to heroku-22
Installing dependencies using bundler 2.3.10
Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
A bunch of gems fetching and installing
Bundle complete! 22 Gemfile dependencies, 78 gems now installed.
Gems in the groups 'development' and 'test' were not installed.
Bundled gems are installed into `./vendor/bundle`
Post-install message from mailjet:
The Ruby wrapper for Mailjet has just been installed successfully, congrats!
Maybe you want to configure your credentials to use your account.
All informations available on https://github.com/mailjet/mailjet-gem.
But if you are using Rails, you'll be glad to generate it easily using:
$ rails generate mailjet:initializer
We hope you will enjoy Mailjet!
Bundle completed (86.70s)
Cleaning up the bundler cache.
Installing node-v16.13.1-linux-x64
Installing yarn-v1.22.17
Detecting rake tasks
Preparing app for Rails asset pipeline
Running: rake assets:precompile
Rails couldn't infer whether you are using multiple databases from your database.yml and can't generate the tasks for the non-primary databases. If you'd like to use this feature, please simplify your ERB.
rake aborted!
Psych::BadAlias: Unknown alias: default
/tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/webpacker-4.3.0/lib/webpacker/env.rb:30:in `available_environments'
/tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/webpacker-4.3.0/lib/webpacker/env.rb:21:in `current'
/tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/webpacker-4.3.0/lib/webpacker/env.rb:15:in `inquire'
/tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/webpacker-4.3.0/lib/webpacker/env.rb:7:in `inquire'
/tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/webpacker-4.3.0/lib/webpacker/instance.rb:11:in `env'
/tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/webpacker-4.3.0/lib/webpacker/instance.rb:18:in `config'
/tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/webpacker-4.3.0/lib/webpacker.rb:34:in `config'
/tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/webpacker-4.3.0/lib/webpacker/railtie.rb:32:in `block in <class:Engine>'
/tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/railties-6.0.5.1/lib/rails/initializable.rb:32:in `instance_exec'
/tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/railties-6.0.5.1/lib/rails/initializable.rb:32:in `run'
/tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/railties-6.0.5.1/lib/rails/initializable.rb:61:in `block in run_initializers'
/tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/railties-6.0.5.1/lib/rails/initializable.rb:60:in `run_initializers'
/tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/railties-6.0.5.1/lib/rails/application.rb:363:in `initialize!'
/tmp/build_f6d25fed/config/environment.rb:5:in `<main>'
/tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
/tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/zeitwerk-2.6.0/lib/zeitwerk/kernel.rb:35:in `require'
/tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/activesupport-6.0.5.1/lib/active_support/dependencies.rb:324:in `block in require'
/tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/activesupport-6.0.5.1/lib/active_support/dependencies.rb:291:in `load_dependency'
/tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/activesupport-6.0.5.1/lib/active_support/dependencies.rb:324:in `require'
/tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/railties-6.0.5.1/lib/rails/application.rb:339:in `require_environment!'
/tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/railties-6.0.5.1/lib/rails/application.rb:523:in `block in run_tasks_blocks'
/tmp/build_f6d25fed/vendor/bundle/ruby/3.1.0/gems/sprockets-rails-3.4.2/lib/sprockets/rails/task.rb:61:in `block (2 levels) in define'
Tasks: TOP => environment
(See full trace by running task with --trace)
!
! Precompiling assets failed.
!
! Push rejected, failed to compile Ruby app.
! Push failed
It was a compatibility issue with the new ruby version, just adding the psych gem fixed this.
gem 'psych', '< 4'

Heroku create gives "Permission denied # rb_sysopen "

I had created a project using "heroku create". After changing the name the domain URL was not working so I deleted the project.
Now I'm executing "heroku create" but it is giving an error. I tried many solutions but none of them are working for me. kindly help.
ANAMIKA#W1650044 MINGW64 /c/Sites/myrubyblog (master)
$ heroku create
WARNING: This is the legacy Heroku CLI with limited functionality. Please install the latest CLI.
WARNING: Installation instructions are at https://cli.heroku.com
heroku-cli: Installing CLI... 24.45MB/24.45MBPermission denied # rb_sysopen - C:\Users\ANAMIKA\AppData\Local/heroku/cli/lib/node.exe
C:/Users/ANAMIKA/.heroku/client/lib/heroku/jsplugin.rb:107:in `initialize'
C:/Users/ANAMIKA/.heroku/client/lib/heroku/jsplugin.rb:107:in `open'
C:/Users/ANAMIKA/.heroku/client/lib/heroku/jsplugin.rb:107:in `block (4 levels) in setup'
C:/Program Files (x86)/Heroku/ruby-2.1.7/lib/ruby/2.1.0/rubygems/package/tar_reader.rb:64:in `each'
C:/Users/ANAMIKA/.heroku/client/lib/heroku/jsplugin.rb:98:in `block (3 levels) in setup'
C:/Program Files (x86)/Heroku/ruby-2.1.7/lib/ruby/2.1.0/rubygems/package/tar_reader.rb:28:in `new'
C:/Users/ANAMIKA/.heroku/client/lib/heroku/jsplugin.rb:96:in `block (2 levels) in setup'
C:/Users/ANAMIKA/.heroku/client/lib/heroku/jsplugin.rb:95:in `open'
C:/Users/ANAMIKA/.heroku/client/lib/heroku/jsplugin.rb:95:in `block in setup'
C:/Program Files (x86)/Heroku/ruby-2.1.7/lib/ruby/2.1.0/tmpdir.rb:88:in `mktmpdir'
C:/Users/ANAMIKA/.heroku/client/lib/heroku/jsplugin.rb:63:in `setup'
C:/Users/ANAMIKA/.heroku/client/lib/heroku/cli.rb:42:in `start'
C:/Program Files (x86)/Heroku/bin/heroku:29:in `<main>'
! Heroku client internal error.
! Search for help at: https://help.heroku.com
! Or report a bug at: https://github.com/heroku/heroku/issues/new
Error: Permission denied # rb_sysopen - C:\Users\ANAMIKA\AppData\Local/heroku/cli/lib/node.exe (Errno::EACCES)
Command: heroku create
Version: heroku/toolbelt/3.99.3 (i386-mingw32) ruby/2.1.7
More information in C:/Users/ANAMIKA/.heroku/error.log
this is saying that you need to update your heroku cli, here are the instructions
depending on the way you installed it, you can update it running
heroku update
or
sudo apt-get update && sudo apt-get upgrade heroku

Installing Ruby on Godaddy Shared Hosting

I'm trying to use Linuxbrew to manage my dependencies; however, when I attempt to install I receive an error.
Error: No such file or directory - /usr/local/bin/rub
I have attempted to install using the source files and running
./configur-prefix=$Home/env
make
make install
which gives the following report:
installing binary commands: /env/bin
/home/tmiles199/downloads/ruby-2.4.1/lib/fileutils.rb:226:in `mkdir': Permission denied # dir_s_mkdir - /env (Errno::EACCES)
from /home/tmiles199/downloads/ruby-2.4.1/lib/fileutils.rb:226:in `fu_mkdir'
from /home/tmiles199/downloads/ruby-2.4.1/lib/fileutils.rb:207:in `block (2 levels) in mkdir_p'
from /home/tmiles199/downloads/ruby-2.4.1/lib/fileutils.rb:205:in `reverse_each'
from /home/tmiles199/downloads/ruby-2.4.1/lib/fileutils.rb:205:in `block in mkdir_p'
from /home/tmiles199/downloads/ruby-2.4.1/lib/fileutils.rb:191:in `each'
from /home/tmiles199/downloads/ruby-2.4.1/lib/fileutils.rb:191:in `mkdir_p'
from ./tool/rbinstall.rb:194:in `makedirs'
from ./tool/rbinstall.rb:306:in `prepare'
from ./tool/rbinstall.rb:344:in `block in <main>'
from ./tool/rbinstall.rb:822:in `block in <main>'
from ./tool/rbinstall.rb:819:in `each'
from ./tool/rbinstall.rb:819:in `<main>'
make: *** [do-install-all] Error 1
Godaddy does not allow sudo or su access. The server info
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-17)
I need Homebrew to install xz and glibc before I can install Ruby, or update the gcc version. Unfortunately, both produce the first error.
Could anyone help me install this package? My real endgoal is updating gcc through brew.
You don't have needed permissions to do that in the shared hosting:
in `mkdir': Permission denied # dir_s_mkdir - /env (Errno::EACCES)
When you try to create the directory, the installation fails.
You need a VPS, a dedicated server or a shared hosting preconfigurated.
I have found out a workaround for this issue to be able to install homebrew without root and sudo access.
Just follow the instruction on the Alternative Installation section of brew.sh and it will wonderfully work with no mayor issues at all.
This option will not work if you do not meet the minimum requirements regarding the glibc version.

heroku assets:precompile error for foundation sites $color

I have an "angular of rails" app using foundation-sites which I'm installing with bower.
Whenever I try to push to heroku, it breaks on running rake assets:precompile with the following error:
remote: rake aborted!
remote: Sass::SyntaxError: $color: "foreground(#09798e)" is not a color for `red'
remote: /tmp/build_2017bed0c047fd92960507e2e0ee8a54/vendor/assets/bower_components/foundation-sites/scss/util/_color.scss:19:in `foundation-badge'
remote: /tmp/build_2017bed0c047fd92960507e2e0ee8a54/app/assets/stylesheets/foundation_and_overrides.scss:21
remote: /tmp/build_2017bed0c047fd92960507e2e0ee8a54/app/assets/stylesheets/cguides.scss:1
remote: /tmp/build_2017bed0c047fd92960507e2e0ee8a54/vendor/bundle/ruby/2.3.0/gems/sass-3.4.22/lib/sass/script/tree/funcall.rb:310:in `reformat_argument_error'
remote: /tmp/build_2017bed0c047fd92960507e2e0ee8a54/vendor/bundle/ruby/2.3.0/gems/sass-3.4.22/lib/sass/script/tree/funcall.rb:149:in `rescue in _perform'
remote: /tmp/build_2017bed0c047fd92960507e2e0ee8a54/vendor/bundle/ruby/2.3.0/gems/sass-3.4.22/lib/sass/script/tree/funcall.rb:123:in `_perform'
remote: /tmp/build_2017bed0c047fd92960507e2e0ee8a54/vendor/bundle/ruby/2.3.0/gems/sass-3.4.22/lib/sass/script/tree/node.rb:58:in `perform'
remote: /tmp/build_2017bed0c047fd92960507e2e0ee8a54/vendor/bundle/ruby/2.3.0/gems/sass-3.4.22/lib/sass/script/tree/list_literal.rb:63:in `block in _perform'
remote: /tmp/build_2017bed0c047fd92960507e2e0ee8a54/vendor/bundle/ruby/2.3.0/gems/sass-3.4.22/lib/sass/script/tree/list_literal.rb:63:in `map'
remote: /tmp/build_2017bed0c047fd92960507e2e0ee8a54/vendor/bundle/ruby/2.3.0/gems/sass-3.4.22/lib/sass/script/tree/list_literal.rb:63:in `_perform'
remote: /tmp/build_2017bed0c047fd92960507e2e0ee8a54/vendor/bundle/ruby/2.3.0/gems/sass-3.4.22/lib/sass/script/tree/node.rb:58:in `perform'
remote: /tmp/build_2017bed0c047fd92960507e2e0ee8a54/vendor/bundle/ruby/2.3.0/gems/sass-3.4.22/lib/sass/tree/visitors/perform.rb:471:in `visit_variable'
remote: /tmp/build_2017bed0c047fd92960507e2e0ee8a54/vendor/bundle/ruby/2.3.0/gems/sass-3.4.22/lib/sass/tree/visitors/base.rb:36:in `visit'
remote: /tmp/build_2017bed0c047fd92960507e2e0ee8a54/vendor/bundle/ruby/2.3.0/gems/sass-3.4.22/lib/sass/tree/visitors/perform.rb:160:in `block in visit'
...
However, when I run RAILS_ENV=production bundle exec rake assets:precompile locally, it goes through with no glitch, making the situation totally confusing to me.
In my bower.json file, I have: "foundation-sites": "latest",
Suffice it to say however, that when I entered heroku bash and checked the contents of vendor/assets/bower_components/foundation-sites/scss/util/_color.scss, it's slightly different from my local version. but no mention of the complained $color: "foreground(#09798e)" in the file.
At the moment, I'm resigned to precompiling the assets locally before push, but it's getting too cumbersome and I need to figure this out.
Thanks.
I had the same problem running my rails app locally. It looks like this error is due to a syntax change between gem foundation-rails 6.2.4 and 6.3.0.
I fixed this by specifying 6.2.4 in my Gemfile:
gem 'foundation-rails', '~> 6.2.4'

Mongoid 3 + Heroku (MongoHQ) cause Moped::Errors::OperationFailure

With Rails 3, after upgrading from Mongoid 2.x to Mongoid 3.x, my Heroku + MongoHQ setup stopped working. Funny thing is, that my development & test frameworks and my whole test suite passes just fine.
I suspect the problem is with my mongoid.yml file, but I've tried searching the docs, google & stackoverflow, and used all the suggested formats, including this: heroku mongohq and mongoid Mongo::ConnectionFailure or actually this: https://gist.github.com/2900804
UPDATED July 16th: This is how my mongoid.yml file looks, after trying multiple things + After what Jason from MongoHQ suggested:
development:
sessions:
default:
database: development
hosts:
- localhost:27017
test:
sessions:
default:
database: test
hosts:
- localhost:27017
production:
sessions:
default:
uri: <%= ENV['MONGOHQ_URL'] %>
options:
skip_version_check: true
safe: true
(to my understanding, it is essentially the same as the one in the links above, except that it uses the uri; I tried the other way, splitting the MONGOHQ_URL into the separate fields as well, but it didn't help)
I've tried setting mongoid as 3.0.0rc and leaving the version blank in my Gemfile. Using the github version failed due to HTTPS certificates or something, so I didn't bother trying it multiple times.
What the action controller says is this:
Moped::Errors::OperationFailure in Home#index
Showing /app/app/views/home/index.html.haml where line #2 raised:
The operation: #<Moped::Protocol::Command
#length=68
#request_id=4
#response_to=0
#op_code=2004
#flags=[:slave_ok]
#full_collection_name=".$cmd"
#skip=0
#limit=-1
#selector={:count=>:posts, :query=>{}}
#fields=nil>
failed with error "db assertion failure"
and when I run
heroku run console
.. I get this:
irb(main):052:0> Location.create!
NoMethodError: undefined method `[]' for nil:NilClass
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.1/lib/moped/node.rb:74:in `block in command'
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.1/lib/moped/node.rb:522:in `[]'
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.1/lib/moped/node.rb:522:in `block (3 levels) in flush'
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.1/lib/moped/node.rb:521:in `map'
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.1/lib/moped/node.rb:521:in `block (2 levels) in flush'
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.1/lib/moped/node.rb:113:in `ensure_connected'
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.1/lib/moped/node.rb:517:in `block in flush'
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.1/lib/moped/node.rb:532:in `logging'
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.1/lib/moped/node.rb:516:in `flush'
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.1/lib/moped/node.rb:505:in `process'
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.1/lib/moped/node.rb:70:in `command'
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.1/lib/moped/node.rb:356:in `refresh'
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.1/lib/moped/cluster.rb:101:in `block in refresh'
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.1/lib/moped/cluster.rb:114:in `each'
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.1/lib/moped/cluster.rb:114:in `refresh'
from /app/vendor/bundle/ruby/1.9.1/gems/moped-1.1.1/lib/moped/cluster.rb:67:in `nodes'
... 15 levels...
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:405:in `__run_callback'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:385:in `_run_save_callbacks'
from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:81:in `run_callbacks'
from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.1/lib/mongoid/callbacks.rb:98:in `run_callbacks'
from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.1/lib/mongoid/persistence/insertion.rb:23:in `prepare'
from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.1/lib/mongoid/persistence/operations/insert.rb:26:in `persist'
from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.1/lib/mongoid/persistence.rb:50:in `insert'
from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.1/lib/mongoid/persistence.rb:251:in `block in create!'
from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.1/lib/mongoid/threaded/lifecycle.rb:173:in `_creating'
from /app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.1/lib/mongoid/persistence.rb:249:in `create!'
from (irb):52
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/commands/console.rb:47:in `start'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/commands/console.rb:8:in `start'
from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'irb(main):053:0>
I think I've googled everything, run through multiple github mongoid issues, read the documentation multiple times ... and I'm running out of ideas here.
Anything come to mind I should try next?
UPDATE July 16th: this is what Heroku says when I git push heroku master (After doing what Jason from MongoHQ suggested):
git push heroku master
Counting objects: 7, done.
Delta compression using up to 16 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 372 bytes, done.
Total 4 (delta 3), reused 0 (delta 0)
-----> Heroku receiving push
-----> Ruby/Rails app detected
-----> Installing dependencies using Bundler version 1.2.0.pre
Running: bundle install --without development:test --path vendor/bundle --binstubs bin/ --deployment
Using rake (0.9.2.2)
Using i18n (0.6.0)
Using multi_json (1.3.6)
Using activesupport (3.2.6)
Using builder (3.0.0)
# ... shortened this #
Using libv8 (3.3.10.4)
Using moped (1.1.2)
Using origin (1.0.4)
Using mongoid (3.0.0.rc)
Using omniauth (1.1.0)
Using quimby (0.4.5)
Using bundler (1.2.0.pre)
Using rails (3.2.6)
Using therubyracer (0.10.1)
Using thin (1.3.1)
Your bundle is complete! It was installed into ./vendor/bundle
Cleaning up the bundler cache.
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
Asset precompilation completed (31.24s)
-----> Rails plugin injection
Injecting rails_log_stdout
Injecting rails3_serve_static_assets
-----> Discovering process types
Procfile declares types -> (none)
Default types for Ruby/Rails -> console, rake, web, worker
-----> Compiled slug size is 18.7MB
-----> Launching... done, v92
http://xxxxx.herokuapp.com deployed to Heroku
To git#heroku.com:xxxxx.git
b2d97xy..7b0aczy master -> master
UPDATE 2 July 16th: did as Jason & MrKurt said (first forgot to run bundle update mongoid, but that didn't help either). Now the error changed, though:
NoMethodError in Home#index
Showing /app/app/views/home/index.html.haml where line #2 raised:
undefined method `[]' for nil:NilClass
Extracted source (around line #2):
1: %h1 Most recent posts
2: - if #posts.length > 0
You will need to use Ruby 1.9.3. See Mongoid documentation here and Heroku documentation here on how to use 1.9.3.
I was also getting similar errors, and I changed my gemfile to include ruby '1.9.3' and everything worked as expected again.
Edit:
#herb pointed out that you need the latest version of bundler for this to work (gem install bundler --pre). Otherwise, ruby '1.9.3' in your Gemfile will not work.
Try adding an "options" area to the default session and add "skip_version_check: true" as one of the options.
Jason
MongoHQ
As a workaround, hardcoding the uri from heroku config seems to do the trick.
ex:
production:
sessions:
default:
uri: "mongodb://heroku:xxxx#domain.mongohq.com:000/appyyyy"
options:
skip_version_check: true
safe: true
I'm guessing the nilclass error was because <%= ENV['MONGOHQ_URL'] %> was returning nil

Resources