I am setting up a Rails Project. Each time I go to start the server, I am getting a big error;
rails server puma
warning: ignoring extraneous `ruby-' prefix in version `ruby-2.0.0-p247'
(set by /Users/jamesnewman/shout_factory/.ruby-version)
/Users/jamesnewman/shout_factory/vendor/bundle/gems/pg-0.15.1/lib/pg.rb:4:in `require': dlopen(/Users/jamesnewman/shout_factory/vendor/bundle/gems/pg-0.15.1/lib/pg_ext.bundle, 9): Library not loaded: /Users/jamesnewman/.rvm/rubies/ruby-2.0.0-p247/lib/libruby.2.0.0.dylib (LoadError)
Referenced from: /Users/jamesnewman/shout_factory/vendor/bundle/gems/pg-0.15.1/lib/pg_ext.bundle
Reason: image not found - /Users/jamesnewman/shout_factory/vendor/bundle/gems/pg-0.15.1/lib/pg_ext.bundle
To try and fix this, I have done;
Removed rvm for rbenv
Uninstalled and Re-Installed PG (with both Home Brew, and on the Gem Level)
Updated to ruby-2.0.0-p247 (as per the request of another dependency)
And many more attempts to fix that I have probably forgotten about. I have googled and tried almost every fix for something like this from different terminal commands, to full on switching from rvm to rbenv.
And just so I knew that it was this project that I was having a hard time with, and not something else, I started the server on a couple of my other projects and everything worked fine.
If anyone has any help on how to fix this, I would really appreciate it. If anyone needs to see maybe the gems I'm using or something else, I'd be more than happy to post it.
Note: This issue was able to be resolved. If anyone else has this issue, it can be fixed. It might be different, but for me, I was able to fix it by uninstalling all of the gems and reinstalling and setting up the entire project/system again from scratch. It was something wrong that I did, but it was able to be fixed.
Hope this helps anyone who may have a similar problem.
I just ran into this issue after downgrading PG from 14 to 13 due to port change. The solution that worked for me was to uninstall pg gem, then reinstall again.
Related
I tried to start a new Rails application, but got "can't find gem railties (=4.2.5)". Does it mean I have inconsistent versions?
I scoured all answers similar to the situation, but no solutions fixed the issue.
I'm on Mac OS. I installed using sudo after the fact thinking that was it as it fixed the issue for someone else. It's not that.
In one of the answers it suggested noting whether it was listed after the gem list command, which it was.
How do I fix this?
Issue resolved. For those who might have a similar issue. I started with the most recent version of rails, 5.1.0. but I needed another version for the assignment, 4.2.5. Initially I uninstalled the 4.2.5 and reinstalled, thinking this would resolve the issue. It did not. However, after getting sidetracked and trying a whole slew of things, I went back to the original idea and uninstalled BOTH 5.1.0 AND 4.2.5, then reinstalled both and the issue was then resolved.
I have no idea why this worked the way it did but it did. I hope this is helpful for those in a similar situation.
sudo has to be used for invoking rails command, since it was installed using root privileges - this should solve the problem.
Operating System I am using is Mac OSX Mountain Lion.
First I will give some back story on how this cluster F started. I am going through a Ruby on Rails Web development book. I want to use PostgreSQL as my server. Before today I was using sqlite3. I downloaded PostgreSQL 9.1 from there website. I used the DMG installer. Once I was done with the install process it asked me to re-boot because of some sort of memory problem, I did that and it installed without error.
The problem started when I tried to use the "Rails Server" command in the terminal. This is what I got (I tried to strip out the unimportant stuff which would clutter everything up)
/Users/Chris/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/gems/pg-0.12.2/lib/pg.rb:4:in `require': dlopen(/Users/Chris/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/gems/pg-0.12.2/lib/pg_ext.bundle, 9): Library not loaded: /usr/lib/libcrypto.dylib (LoadError)
Referenced from: /usr/lib/libpq.5.dylib
Reason: Incompatible library version: libpq.5.dylib requires version 1.0.0 or later, but libcrypto.0.9.8.dylib provides version 0.9.8 - /Users/Chris/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/gems/pg-0.12.2/lib/pg_ext.bundle
...
from /Users/Chris/.rvm/gems/ruby-1.9.3-p194#rails3tutorial2ndEd/gems/railties-3.2.8/lib/rails/commands.rb:50:in
I have read through the out put and I have done a lot of Google searching, and what I have found is that it's a problem with which version of libcrypto the server is fetching. Or something about the libssl. I have gone through the solutions on google and nothing seems to be working. Hopefully someone has had the same problem I have, and can help me.
Thanks in advance! -Chris
I really recommend you to use Homebrew to install postrgresql. It helps you to install all proper dependencies for version which correctly works with rails.
$ brew install postgresql
Do not forget to follow after install instructions from homebrew
Are you sure you installed PostgreSQL server/rubygem successfully? From the stack trace I think there's a problem about it.
If your PostgreSQL server/rubygem are working well, then switch another webserver, mongrel/thin are both OK, both have better performance than the default rails server(webrick) and easy to use.
I have read just about every post regarding rails errors looking for the solution to my issues and while I have resolved some, I come up with more. I upgraded to Snow Leopard and installed RVM and Rails according to the Agile Development with Rails book. However once I create my app folders and do RAKE, I get this error and I just can not figure out how to fix it. I've tried re-installing everything several times to no avail. Is this an architecture problem? or do I need to find a library and load it? how do I do that?
rake aborted!
dlopen(/opt/local/lib/ruby/1.8/i686-darwin9/digest/sha1.bundle, 9): Library not loaded: /opt/local/lib/libcrypto.1.0.0.dylib
Referenced from: /opt/local/lib/ruby/1.8/i686-darwin9/digest/sha1.bundle
Reason: no suitable image found. Did find:
/opt/local/lib/libcrypto.1.0.0.dylib: mach-o, but wrong architecture - /opt/local/lib/ruby/1.8/i686-darwin9/digest/sha1.bundle
(See full trace by running task with --trace)
There was probably a change in your system. You might have moved or deleted some files or folders, which were needed by ruby.
rvm reinstall ree
Or spyle's answer is basically correct, but ewww macports. go go Homebrew!
I had this problem with ruby 1.8.7/passenger/apache stack. Reinstalling ruby (via macports) and rebuilding it against the openssl library fixed this for me.
I have a rails application that I deploy on Heroku. I'm using several different machines, and I noticed that when I add new dependencies (so that Gemfile.lock is rebuilt) and do bundle install on my Windows computer at home, push to Heroku fails with the following error:
Unresolved dependencies detected; Installing...
Windows Gemfile.lock detected, ignoring it.
You have modified your Gemfile in development but did not check
the resulting snapshot (Gemfile.lock) into version control
...
Gemfile.lock IS under version control, but Heroku appearently chooses to ignore it since it's created in Windows, and then complains that it's missing seconds later. Why does this happen? And how can I solve it?
I fixed mine by opening Gemfile.lock and deleting the following two lines:
PLATFORMS
x86-mingw32
So now i just need to make a script that bundles then removes that from the lock file.
Like matt commented above:
The problem is that Bundler creates different Gemfile.locks for Windows. The only solution is to create and commit the lock file on a *NIX system.
I would suggest to create a virtual machine running e.g. Ubuntu – maybe using Virtual Box. You can even get ready-to-use virtual machines – for example here.
From the Heroku Docs:
If the platforms section of your Gemfile contains Windows entries,
such as mswin or mingw, then the Gemfile.lock file will be ignored.
Just battled through this problem for a while.
I trimmed my gemfile back to just rails and still had the issue. Then, thinking that heroku had demanded an update of the heroku gem today, I looked closer at heroku changes.
It seems the 1.9.2 ruby "bamboo" stack is now the default one - my app is still running on the 1.8.7 stack. So I ran "heroku stack:migrate bamboo-mri-1.9.2" and updated the stack to 1.9.2 - not something I wanted to do, but you know what, it fixed the issue above.
Of course, I didn't want to be on the 1.9.2 stack, so I migrated back down to the 1.8.7 stack, and things installed correctly again. So I think this is a workaround - and probably an overly complex one - but it seemed to "flush" whatever the error was heroku-side. As nothing I did locally (and I tried a LOT of things from StackOverflow articles) had any effect, the push just kept failing as above.
So yeah, this fixes it. Doesn't take too long either. But suspect a better workaround may be spotted by more heroku-knowledgeable developers !
Make sure you commit the changes to Gemfile.lock after installing the bundle. On your next push to Heroku, the new gems should be installed correctly.
So I was following the steps on Hivelogic to get ruby on rails setup on my machine. After compiling and installing, I used the which ruby command to double check it installed in the right place. It did not. I was able to install the Rails and MySQL gems though, but both POW and localhost:3000 don't work.
Is there anything wrong with having it in the usr/bin directory instead of usr/local/bin? My usr/local/bin is practically empty, but usr/bin has a ton of files in it.
Edit: I reinstalled ruby to usr/local/bin but now Rails won't install. Is it a problem that it's already installed in usr/bin?
That page is a few years old. The current best practice for Mac and Linux is to use rvm. You can see, even Hivelogic uses rvm now (though I'm not sure how I feel about installing it system wide).
Anything that recommends installing from source as the first option instead of a last-resort fallback is probably bad advice. It's better to install using a package manager like MacPorts or Homebrew both of which have current versions of Ruby 1.8 and 1.9.
MacPorts installs everything in /opt specifically to avoid conflict with system files. From time to time Apple will distribute an update that patches ruby and this can mess up anything you have in the way of dependencies if you've been using a modified /usr/bin/ruby. Generally the system ruby is supposed to be left as-is.
You can replace the "compile ruby" step with an installer like that and save yourself a lot of trouble in the future. Just be sure to have /opt/local/bin as one of the first items in your PATH just as you would for other solutions.
Since installing Ruby and Rails and some kind of database can be a confusing process, it seems like there should be a meta-installer to help you through the process.
So I finally managed to get rails installed in the correct spot. I had to change the line in my .profile to export PATH="/usr/local/bin:$PATH" and then do a sudo gem update --system after installing rubygems before rails could actually be installed.
RVM and Homebrew did not help at all.
EDIT: Since people have a problem with this answer, I'm giving an update. I have since installed RVM and am liking it, but only because I have a friend I ask all my questions to, as RVM is really confusing if you're not used to doing a lot on the command line. I needed help from him to install it because I didn't have any of the bash files, and thought they were hiding somewhere. If you're missing the bash files, just create them yourself. This took a long time to get working, but now I apparently have it setup right.