I have been working on an ruby app for a while, and today starting up my server via "rails server" I now get this:
/Users/Ross/rails_projects/splash/json/ruby/1.9.1/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require': no such file to load -- sqlite3/sqlite3_native (LoadError)
What I changed before this, was I installed the curb and json gems. The funny thing is it still works on Heroku, just not my local machine. So it must be environmental. However, I cannot figure out what broke and why.
Still stuck, noticed if I load up irb:
MacBook-Pro:splash Ross$ irb
ruby-1.9.2-p136 :001 > require 'sqlite3'
=> true
ruby-1.9.2-p136 :002 >
So why does that work and not the rails server? I even tried to reinstall rails. Nothing. Path issue?
Update: Still not working, tried another of solutions: building from source, uninstall, reinstall, upgrade rails, etc. The message has changed slightly:
/Volumes/Macintosh HD/Users/Ross/rails_projects/splash/json/ruby/1.9.1/gems/sqlite3-1.3.3/lib/sqlite3.rb:6:in `require': no such file to load -- sqlite3/sqlite3_native (LoadError)
I really need help, this is really killing my productivity.
Try this, install homebrew and rvm as per my blog post here.
$ rvm --default 1.9.2
It'll spit out a comment giving you the install command to grab the latest ruby. Then repeat the above command to set it. You can test this by doing
$ ruby -v
It should show you something similar to the following, although I'm using 1.8.7
$ ruby -v
ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin10.2.0]
Now simply reinstall rails gem install rails and do bundle install. By using rvm, and hopefully a newer version of ruby, it'll setup a whole new space for you to test out a new deploy. Hopefully you won't get the same issue again. Keep us posted :)
Thanks for the response Mike. Funny thing was it didn't work. After I did it, I got a message about curl was missing. So I installed it and the sqlite3 error popped up immediately again.
A ton more Googling and I found an post about installing sqlite3 through RVM.
so I did a:
rvm gem install sqlite3
then I did:
rm -rf .bundle && bundle install
Then it started working. I'm not sure if it was the deleting the bundle or installing through rvm, but either way it's working again.
Related
I just logged into my Ubuntu workspace on Cloud9. Upon logging in I saw an error.
RVM used your Gemfile for selecting Ruby, it is all fine - Heroku does
that too, you can ignore these warnings with 'rvm rvmrc warning ignore
/home/ubuntu/workspace/Simutronix/Gemfile'. To ignore the warning for
all files run 'rvm rvmrc warning ignore allGemfiles'.
Which I've not seen before and wasn't occurring when I last used the workspace. I then attempted to run the Rails server.
rails server -b $IP -p $PORT
I got an error message back.
bash: rails: command not found
I then tried to run bundle install which also came back with command not found.
ruby -v returns ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux].
What's likely to have happened to cause this to happen in between logins and what can I do to fix it?
Looks like Ubuntu can't find your Rails installation. Make sure you have Rails installed on your workspace by typing:
rails -v
If it is properly installed, It should return something like
Rails 5.0.2
(depending upon your Rails version.)
If you don't have Rails installed, you can install it by typing
gem install rails
You can append --no-doc to the above command if you don't want it to install documentation, thereby speeding up the installation process (That's totally up to you, though. It won't affect your installation in any other way. I promise!)
If this doesn't solve your problem, please update your answer with your Gemfile.
Likely the Ruby version defined in your Gemfile and/or .ruby-version changed, which means you will have to install bundler and bundle the gems again. Running this should solve the issue:
gem install bundler
bundle install
At first I could not create a new Ruby project and I was getting a error about the bin path. I uninstalled ruby and reinstalled it.
Now I get this error whene executing rails --version:
mackbookpro:desktop 411techhelp$ rails --version
/usr/local/rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:7:in `require': no such file to load -- rubygems (LoadError)
from /usr/local/rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:7
What is going on and how can I fix this?
It looks very much like uninstalling ruby also uninstalled rubygems, but you didn't re-install the latter (or your installation of rubygems is/was for a different ruby version).
So long story short I was running out of room on my dual booted ubuntu laptop. I decided to delete some older versions of gems to make some room which worked. Great, except now I can't get rails to work on my machine anymore - rails console and rails server is failing. This is the error I see when I type in rails s;
jmtoporek#jmtoporek-laptop:~/rails/pskr2$ rails s
/home/jmtoporek/.rvm/gems/ruby-1.9.2-p180/gems/hpricot-0.8.6/lib/fast_xs.so: [BUG] Segmentation fault
ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]
/usr/bin/rails: line 104: 4807 Aborted /usr/bin/ruby /usr/share/rails/railties/bin/rails ${OVERWRITE_OPTION} "${RAILS_PKG_DESTINATION}" "${INTERNAL_OPTIONS}" -d $DATABASE
ln: target `/home/jmtoporek/rails/pskr2/s/vendor/' is not a directory: No such file or directory
ln: creating symbolic link `/home/jmtoporek/rails/pskr2/s/vendor/rails': No such file or directory
ln: creating symbolic link `/home/jmtoporek/rails/pskr2/s/doc/api': No such file or directory
I suppose reinstalling rails should be enough, because it installs several gems to run properly. Simply run gem install rails and see if it works again.
Also, if you use RVM, you can use a different installation executing something like this:
rvm use ruby-1.9.3-p286#rails328 --create --default
..and then, installing rails again:
gem install rails
Just remember this last solution requires you to install all other gems as well.
I reinstalled railties - despite the fact that the gem was already installed something must have gotten messed up. I reinstalled railties, which fixed the issue. I wish I had looked closer at the error message. It appears that there is a copy of railties inside the rails gem directory.
I just installed rvm + rails 3+ on centos 6.0 at Rackspace cloud server. Everything works fine, but sometimes when i ssh to server i can't use rake, bundle or any other rails related commands it always shows me errors like:
bash: rake: command not found
when i try to run bundle install it shows me this error:
ERROR: Gem bundler is not installed, run `gem install bundler` first.
but i do have it installed for sure and it worked before.I can use rvm rake db:migrate - but it used to without rvm prefix...Please help i dont know why is that happening - maybe something wrong with bash profile...
have you used a ruby ?
rvm use 1.9.3
this will select properly environment and make all commands working properly.
to make this setting permanent for new sessions also use:
rvm use 1.9.3 --default
On a VPS I tried to install Ruby. Because of memory exhaustion problems, we were unable to compile ruby 1.9.2 , and we decided to give Ruby Enterprise Edition a try. This compiled without complaining about memory problems.
Next, we install rubygems, and to test that it's working, I installed haml. It worked.
The next step was to install rails, via gem install rails. The version it downloaded was the latest, 3.0.5. Installation went ok. However, when I try to create a new project, I receive:
no such file to load -- rails/cli
Looking around on the internet, people said this is a problem related to older versions of rails, and some of them suggested to do a gem clean. I didn't have any other version of ruby before, therefore, no other version of rails. But, just to be sure, I did a gem clean and then reinstalled rails. The problem persists.
How can I fix this?
Make sure your running the gem binary that Ruby Enterprise Edition installed. So rather than:
gem install rails
it would be something like:
sudo /opt/ruby-enterprise-X.X.X/bin/gem install rails
To save having to type the whole path each time, you can symlink the REE binaries with something like:
sudo ln -sf /opt/ruby-enterprise-X.X.X/bin/* /usr/bin/.