Rails installation on hostmonster bundle install fails - ruby-on-rails

So I had a rails app up and working on my hostmonster account just fine. I then updated a few things in my dev environment / pushed them up to github / pulled them back down on my production environment. Now its giving me the error Could not find pg-0.17.1 in any of the sources (Bundler::GemNotFound).
This is a new gem i installed in my dev because i was attempting to move to postgresql for dev and live....for now im using postgresql in dev and mysql2 in production. I know this isn't optimal but im working on it.
I tried running bundle install to get the pg gem installed and it fails with the error
Gem::Exception: Cannot load gem at [/usr/lib64/ruby/gems/1.9.3/cache/rake-10.2.2.gem] in /home4/muscorei/workspace/vollapp
An error occurred while installing rake (10.2.2), and Bundler cannot continue.
Make sure that gem install rake -v '10.2.2' succeeds before bundling.
I try installing rake and it works fine...try again..same error. I have found one question on here that seems to fix this for others but it requires running of gem update --system which you cannot do for hostmonster. Any ideas?
So here is another "related" issue. When i type in gem list --local I see that rails is installed at version 4.1.0....however when i do rails -v it shows the systemwide version of 3.2.13. I don't EVER have any of these annoying issues on my dev environment.

Related

An error occurred while installing mysql2 (0.5.4), and Bundler cannot continue - in rails project

I'm trying to create a project with mysql as a database, ran command
rails new project_name -d mysql
got the following errors
Could not find gem 'mysql2 (~> 0.5)' in locally installed gems. rails importmap:install
Could not find gem 'mysql2 (~> 0.5)' in locally installed gems. Run bundle install to install missing gems.
rails turbo:install stimulus:install Could not find gem 'mysql2 (~> 0.5)' in locally installed gems.
Run bundle install to install missing gems. "
so i ran
bundle install
but it fails and at the end it tells me
An error occurred while installing mysql2 (0.5.4), and Bundler cannot continue
full error https://pastebin.com/jiX7V0Z0
I'm running windows (all answers I found were for linux or mac), any help is appreciated
Edit : as Christos-Angelos Vasilopoulos mentioned, answer in this issue worked https://github.com/brianmario/mysql2/issues/1210#issuecomment-965862944
what I did was the first two steps
1 - Start a cmd terminal and run ridk explicitely by running:
c:\your path to Ruby31-x64\ridk_use\ridk.cmd enable.
This gives you the right environment to do the rest.
2 - From that cmd, run
gem install mysql2 --platform=ruby -- --with-mysql-dir=c:/your path to Ruby31-x64/msys64/mingw64
(no particular quote was neeeded and I used forward slashes).
It is an open issue with mysql2 though there is a workaround. Check this thread from GitHub the last comment is the thing you need.

trouble installing postgresql for rails app

So I would like to deploy my rails app on heroku right? Wanna switch from sql3 to postgresql. Should be simple but I keep getting an error when trying to bundle with gem 'pg' in my gemfile. I used homebrew to install postgresql with all its native extensions before trying to bundle. Any ideas? I am on Mac OSX high sierra.
An error occurred while installing pg (1.1.3), and Bundler cannot
continue.
Make sure that gem install pg -v '1.1.3' --source 'https://rubygems.org/'
succeeds before bundling.
That's all I get for the error. Not helpful. I went ahead and uninstalled postrgresql that I installed locally to my machine from their website as well as with homebew. Gonna start from scratch. I haven't done this in years so any help would be appreciated!
I've run into this before where you attempt to install the PG gem, but postgres is not yet installed. Even if you install postgres after that, you'll still run into troubles (this has to do with required libraries not being available or not found). I would recommend uninstalling both, then installing Postgres first, then the PG gem. This is a common gotcha, unfortunately: Installing PG gem on OS X - failure to build native extension Also, I would recommend https://postgresapp.com/ if you continue to have trouble installing PG or having the gem not see your install properly.
After tons of research and trying everything, found an older question on stackoverflow from 2014. If you install postgresql with homebrew like I did, running the command ARCHFLAGS="-arch x86_64" gem install pg will install the gem if bundling or gem install pg don't work. Hope that helps other people who might be stuck like I was

Ruby on rails new app is not creating

I started to develop the new RoR web app and faced weird issue.
I wanted to create new app with Postgresql. So I installed the Postgres with brew and MacOS desktop app. And type rails new test-app --database=postgresql.
At this moment, I can't install bundles because there is certain
error.
An error occurred while installing pg (1.0.0), and Bundler cannot
continue.
Make sure that `gem install pg -v '1.0.0' --source
'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
pg
run bundle exec spring binstub --all
Could not find gem 'pg (< 2.0, >= 0.18)' in any of the gem sources
listed in your Gemfile.
Run `bundle install` to install missing gems.
So I can't start new app.
Is this an issue that is occurring because of the mismatch between ruby and postgres version?
And how can I create new app with postgres?
I am currently using Mac OS high Sierra, postgres 10.5, rails 5.2.1
Try to skip running Bundler: rails new test-app --database=postgresql --skip-bundle
Once you've generated your app, you'll still have to troubleshoot why pg ins't installing. The PG gem should install just fine as long as the database is there and your system can build the gem's native extensions, so my first guess is either Postgres isn't installed or it can't be found in your environment.
Either way, this does answer your question. Skip the bundle and voila - Rails will generate a new clean app for you.
I've posted some comments, but i already seen that it seems to be an error when installing postgresql via brew. It's not common, but it happens sometimes.
Here's a quick fix:
brew install libpqxx
Make sure to run also
brew update
and restart your PostgreSQL server via:
brew services restart postgresql
Also make sure to clean up brew:
brew cleanup
If the error is still there, post your Gemfile and your database.yml file as well.
Greetings!

Ruby -- run a local gem server

I'm a Ruby novice working on a Rails application. We're trying to speed up our installs by running a local gem server instead of always going out to rubygems.org. I found that running the command:
gem server
sets this up, with the server running at localhost 8808. However when I add a source line for that URL to my Gemfile, and then run "bundle install", it fails after a minute or so saying:
Gem::RemoteFetcher::FetchError: bad response Not Found 404 (http://localhost:8808/gems/rake-10.3.1.gem)
An error occurred while installing rake (10.3.1), and Bundler cannot continue.
Make sure that `gem install rake -v '10.3.1'` succeeds before bundling.
If I browse to that server, I see a page saying that Rake, version 10.3.1 is installed, but when I go to the listed URL, I do get a 404 page. After running the gem install command, I still get a 404 page, but the bundle install gets a step further and fails with:
Gem::RemoteFetcher::FetchError: bad response Not Found 404 (http://localhost:8808/gems/activesupport-3.2.12.gem)
An error occurred while installing activesupport (3.2.12), and Bundler cannot continue.
Make sure that `gem install activesupport -v '3.2.12'` succeeds before bundling.
What's going on here? I have both source lines in my Gemfile, so I'd expect the bundler to go out to rubygems.org for anything it couldn't find locally, but it also seems like the gems are in fact installed locally already. Do I have to run individual installs on each gem dependency? I'm sure I'm doing something obviously wrong here, but I'm don't know what it is.
This is a decent walkthrough of a few situations you might encounter while setting up a gem server: http://guides.rubygems.org/run-your-own-gem-server/
This one isn't half-bad either, if you're looking to just use local versions of gems (though this technique doesn't set up a separate gem server): https://coderwall.com/p/tqdrhq

no metadata found in activereocrd-3.2.9.gem when running bundle install in a rails 3.2.9

am a newbie in rails. working on Windows 7, 64 bits. Installed my environment through RailsInstaller. latest version ofcourse.
When creating a new project, (keeping the gem file as default) and having the bundle install run, am getting the error
gem::package::FormatError: no metadata found in
D:/RailsInstaller/Ruby1.9.3/bin/cashe/activereocrd-3.2.9.gem
and error occurrend while installing activerecord (3.2.9), and bubndler cannot continue.
Make sure that gem install activerecord -v '3.2.9' succeeds before building.
I tried to run the gem install activerecord..as instructed still bundle install does not work and i cannot run the rails server. (rails s)
When changing the rails version in the app gem file to 3.2.8 instead of 3.2.9 everything seems to work and the rails server runs succefully. What is wrong?
I uninstalled railsinstaller and all other leftover folders.
reinstalled railsinstaller. Problem solved.

Resources