Rails App - with pg database - errors with setup - ruby-on-rails

I am in rails setup hell.
I tried to make an app 2 years ago and after endless problems with it, I tried to make a fresh app and start again. I"m now having the same problem I had the first time around in getting the pg database setup, but none of the solutions offered for the first problem are working this time. My post about the problem the first time is here: Installing PG gem on OS X - failure to build native extension
Currently - I'm getting this error:
An error occurred while installing pg (0.18.4), and Bundler cannot continue.
Make sure that gem install pg -v '0.18.4' succeeds before bundling.
I have tried uninstalling and reinstalling pg. I have tried installing with home-brew. I have tried all of the suggestions in the previous post I wrote about this problem with my first app. I've tried the solutions in this post:
Ruby/PgSQL error on Rails start : cannot load such file -- pg_ext (LoadError)
Each time, the gem installs correctly. It's just I can't start the server or do anything from the command line - this error keeps coming up.
One of the steps I tried involved adding this to my command line. It's a straight copy & paste. I don't know what it means. I'm wondering if its a source of my issue:
export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.4/bin
When I try:
rake rails:update:bin
I get this error:
rake aborted!
LoadError: cannot load such file -- nokogiri/nokogiri
Does anyone know how to solve this problem? I'm in rails hell!

A similar issue is occur by a user. Please have look to this link. Hope this may helpful!!
Error message: Make sure that `gem install pg -v '0.18.1'` succeeds before bundling

Related

Debug Ruby/Rails startup issue

Staring at an error like so:
Exiting
/Users/llcool/.rvm/gems/ruby-2.6.3/gems/actionpack-5.2.4.5/lib/action_dispatch/middleware/static.rb:111:in `initialize': wrong number of arguments (given 3, expected 2) (ArgumentError)
Where's my best starting point to figuring out what the issue is here? I've tried gem pristine and bundle install but the issue still persists. Some version conflict somewhere I assume.
UPDATE 1
After running some of the commands suggested I'm now getting this error :(
/Users/llcool/.rvm/gems/ruby-2.6.3/gems/bcrypt-3.1.16/lib/bcrypt.rb:12:in `require': incompatible library version - /Users/llcool/.rvm/gems/ruby-2.6.3/gems/bcrypt-3.1.16/lib/bcrypt_ext.bundle (LoadError)
UPDATE 2
Still having issues getting this app to load...
Fast Debugger (ruby-debug-ide 0.7.1.beta3, debase 0.2.5.beta2, file filtering is supported) listens on 0.0.0.0:55189
Uncaught exception: incompatible library version - /Users/llcool/.rvm/gems/ruby-2.6.3/gems/bcrypt-3.1.16/lib/bcrypt_ext.bundle
I've tried update, pristine, uninstall, reinstall, etc all with no luck.
When I have seen this before I delete the Gemfile.lock file, update gem and bundler:
gem update --system
And
bundle update --bundler
Then run bundle install again and see if that clears it up.

Ruby on Rails db migrate error while loading the hoe gems

I have been having this problem the whole day. whenever i try to do a rake db:migrate command on rails i keep getting this error.
"error while loading the hoe gem.
Please install it by running the following:
$ [sudo] gem install hoe".
But everytime i run and update all my gems i still get the same error.
The hoe gems i have already installed is the latest version (hoe 3.15.3)
Please help.
Am running rails 5.0.0.1this is the error i keep getting
Do you have the correct version? check your Gemfile.
Use bundle install to install correct version
I kind of found a way around it. I just deleted the previous app folder, created a new one and the problem was fixed. Good thing i was just starting out.

Capistrano deployment broken by new request for Capistrano-Harrow gem?

I thought my capistrano version was locked to 3.4.0, however it seems that it updated to 3.5. I tried going back to 3.4, but I keep getting the following message when I try to deploy my project to server.
DEBUG [72bb6fc3] An error occurred while installing capistrano-harrow (0.3.2), and Bundler cannot
continue.
Make sure that `gem install capistrano-harrow -v '0.3.2'` succeeds before
bundling.
I'm not familiar with capistrano-harrow, but read a little and doesn't seem like something I need. I did add to my gemfile in hopes of getting the deployment to send but even though that seemed to install fine, it still errors out for deployment. When I try executing gem install capistrano-harrow -v '0.3.2' - I get the following message and it doesn't install.
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
bad response Not Found 404 (https://rubygems.global.ssl.fastly.net/quick/Marshal.4.8/capistrano-harrow-0.3.2.gemspec.rz)
Anyone know how I can either, opt out of harrow to try and get my deploy to work, or correct this issue to move forward? Thanks!
Update
I ran the following command to "opt-out", however, it still needs to build/install the gem I suppose which is currently the real issue.
git config harrow.disabled true
capistrano-harrow's 0.3.2 version seems to be yanked from Rubygems. There's a hint in the ERROR message you've pasted: Not Found 404 was received from the CDN.
If you're back on 3.4, the gem is not supposed to be in use but if you're running 3.5, please try to bundle update capistrano.

Debugging error in Rails app running on Webrick server

I am running a Rails app on the webrick server and wanted to get error messages to be displayed to me in the console. I installed the debugger 'gem install debugger' and the installation went off without a glitch but when I restarted the server by typing in rails s --debugger, I got:
You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'
Therefore I tried installing ruby-debug gem but I got the following error:
ERROR: Error installing ruby-debug:
ERROR: Failed to build gem native extension.
/Users/Me/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
Can't handle 1.9.x yet
* extconf.rb failed *
My query is: what is going wrong with the installation? Secondly, what would be the best way for me to get error messages to be displayed to me?
For sure I'm late but just for anyone stuck on this, I had the same problem and fixed it by adding "gem 'debugger'" to the gemfile and running bundle update

Ruby on Rails TypeError

I have been working on a ruby on rails application and ran into the following error when doing just about anything, including installing a gem, updating the bundle, installing the bundle.
ERROR: While executing gem ... (TypeError)
incompatible marshal file format (can't be read)
format version 4.8 required; 31.139 given
I have uninstalled RVM and completely removed all files from it, then tried to install a gem, but still get the same error.
I had this exact problem, and it took me forever to figure it out. To fix it, I ran the following command:
bundle install --full-index
My guess is that I ended up with a corrupted rubygems index after my computer locked up, and this command forces a fresh download of the index.
Hopefully this helps someone who runs into this.
Change the source in your gemfile to:
source 'https://rubygems.org'
https://github.com/grosser/parallel_tests/pull/183

Resources