WebFaction
Community site: login faq

Hello there,

So, here's another sad story about a guy who is falling on hard luck while deploying his first Rails application. I followed the Capistrano instructions in the WebFaction KB, and everything went without a hitch. That is, until I went to my website to verify that everything is up and running. I get a Phusion Passenger Error page, Ruby (Rack) application could not be started.

The exact error message displayed on the page is: Could not find ansi-1.4.0 in any of the sources (Bundler::GemNotFound)

So, here's where I get confused. I didn't use the ansi gem in my app development, and subsequent attempts to install this gem to appease the Phusion gods do not make the error message go away. Secondarily, as you might expect me to say, the app was humming right along when testing it on the development environment.

The backtrace is also full of good stuff that I don't even comprehend at this point:

0   /home/jeremyfuksa/webapps/tcn_5by5/gems/gems/bundler-1.0.18/lib/bundler/spec_set.rb 88  in `materialize'
1   /home/jeremyfuksa/webapps/tcn_5by5/gems/gems/bundler-1.0.18/lib/bundler/spec_set.rb 82  in `map!'
2   /home/jeremyfuksa/webapps/tcn_5by5/gems/gems/bundler-1.0.18/lib/bundler/spec_set.rb 82  in `materialize'
3   /home/jeremyfuksa/webapps/tcn_5by5/gems/gems/bundler-1.0.18/lib/bundler/definition.rb   90  in `specs'
4   /home/jeremyfuksa/webapps/tcn_5by5/gems/gems/bundler-1.0.18/lib/bundler/definition.rb   135 in `specs_for'
5   /home/jeremyfuksa/webapps/tcn_5by5/gems/gems/bundler-1.0.18/lib/bundler/definition.rb   124 in `requested_specs'
6   /home/jeremyfuksa/webapps/tcn_5by5/gems/gems/bundler-1.0.18/lib/bundler/environment.rb  23  in `requested_specs'
7   /home/jeremyfuksa/webapps/tcn_5by5/gems/gems/bundler-1.0.18/lib/bundler/runtime.rb  11  in `setup'
8   /home/jeremyfuksa/webapps/tcn_5by5/gems/gems/bundler-1.0.18/lib/bundler.rb  107 in `setup'
9   /home/jeremyfuksa/webapps/tcn_5by5/gems/gems/passenger-3.0.9/lib/phusion_passenger/utils.rb 326 in `prepare_app_process'
10  /home/jeremyfuksa/webapps/tcn_5by5/gems/gems/passenger-3.0.9/lib/phusion_passenger/rack/application_spawner.rb  73  in `spawn_application'
11  /home/jeremyfuksa/webapps/tcn_5by5/gems/gems/passenger-3.0.9/lib/phusion_passenger/utils.rb 572 in `report_app_init_status'
12  /home/jeremyfuksa/webapps/tcn_5by5/gems/gems/passenger-3.0.9/lib/phusion_passenger/rack/application_spawner.rb  72  in `spawn_application'
13  /home/jeremyfuksa/webapps/tcn_5by5/gems/gems/passenger-3.0.9/lib/phusion_passenger/utils.rb 479 in `safe_fork'
14  /home/jeremyfuksa/webapps/tcn_5by5/gems/gems/passenger-3.0.9/lib/phusion_passenger/rack/application_spawner.rb  63  in `spawn_application'
15  /home/jeremyfuksa/webapps/tcn_5by5/gems/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb 264 in `spawn_rack_application'
16  /home/jeremyfuksa/webapps/tcn_5by5/gems/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb 137 in `spawn_application'
17  /home/jeremyfuksa/webapps/tcn_5by5/gems/gems/passenger-3.0.9/lib/phusion_passenger/spawn_manager.rb 275 in `handle_spawn_application'
18  /home/jeremyfuksa/webapps/tcn_5by5/gems/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb   357 in `__send__'
19  /home/jeremyfuksa/webapps/tcn_5by5/gems/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb   357 in `server_main_loop'
20  /home/jeremyfuksa/webapps/tcn_5by5/gems/gems/passenger-3.0.9/lib/phusion_passenger/abstract_server.rb   206 in `start_synchronously'
21  /home/jeremyfuksa/webapps/tcn_5by5/gems/gems/passenger-3.0.9/helper-scripts/passenger-spawn-server  99

I fully realize that something just isn't set up right. I just need to figure out what I did wrong. Anyone out there with some insight into this problem?

asked 14 Nov '11, 23:21

3rdmartini
113
accept rate: 0%

The gem maybe a dependency of one of your other gems. Can you tell us if you see the directory for that gem in this directory:

/home/jeremyfuksa/webapps/tcn_5by5/gems/gems/
(14 Nov '11, 23:32) neeravk

Nope. Not there. In fact, there are a couple of other gems that I know I'll need that aren't there either.

(14 Nov '11, 23:33) 3rdmartini

Did you follow the procedure here to install them?
http://docs.webfaction.com/software/rails.html#installing-gems

(14 Nov '11, 23:36) neeravk

I did not. But I'm doing it now and the curb gem completely exploded as it was trying to install.

The error: Installing curb (0.7.16) with native extensions /usr/local/ruby1.8.7ee/lib/ruby/site_ruby/1.8/rubygems/installer.rb:529:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

(14 Nov '11, 23:42) 3rdmartini

You need to first install curl using:

cd ~/src
VER=7.21.0
wget -c "http://curl.haxx.se/download/curl-$VER.tar.gz"
tar -xzf curl-$VER.tar.gz
cd curl-$VER
./configure --prefix=$HOME
make
make install
export CURL_CONFIG=$HOME/bin/curl-config

and then install the gem.

(14 Nov '11, 23:50) neeravk

Nope. Sorry. Now it's a slightly different error message:

ERROR: Error installing curb: ERROR: Failed to build gem native extension. /usr/local/ruby1.8.7ee/bin/ruby extconf.rb

(15 Nov '11, 00:00) 3rdmartini

Log for the gem make:

make
gcc -I. -I. -I/usr/local/ruby1.8.7ee/lib/ruby/1.8/i686-linux -I. -DRUBY_EXTCONF_H=\"curb_config.h\"  -D_FILE_OFFSET_BITS=64  -fPIC -g -O2    -g -Wall  -c curb_errors.c
gcc -I. -I. -I/usr/local/ruby1.8.7ee/lib/ruby/1.8/i686-linux -I. -DRUBY_EXTCONF_H=\"curb_config.h\"  -D_FILE_OFFSET_BITS=64  -fPIC -g -O2    -g -Wall  -c curb_easy.c
gcc -I. -I. -I/usr/local/ruby1.8.7ee/lib/ruby/1.8/i686-linux -I. -DRUBY_EXTCONF_H=\"curb_config.h\"  -D_FILE_OFFSET_BITS=64  -fPIC -g -O2    -g -Wall  -c curb.c
curb.c: In function ‘Init_curb_core’:
curb.c:366: error: ‘CURLOPT_SEEKFUNCTION’ undeclared (first use in this function)
curb.c:366: error: (Each undeclared identifier is reported only once
curb.c:366: error: for each function it appears in.)
curb.c:367: error: ‘CURLOPT_SEEKDATA’ undeclared (first use in this function)
curb.c:368: error: ‘CURLOPT_SOCKOPTFUNCTION’ undeclared (first use in this function)
curb.c:369: error: ‘CURLOPT_SOCKOPTDATA’ undeclared (first use in this function)
curb.c:370: error: ‘CURLOPT_OPENSOCKETFUNCTION’ undeclared (first use in this function)
curb.c:371: error: ‘CURLOPT_OPENSOCKETDATA’ undeclared (first use in this function)
make: *** [curb.o] Error 1
(15 Nov '11, 00:05) 3rdmartini

I know since i tried it myself, using the above commands should get rid of it.

(15 Nov '11, 00:15) neeravk

I installed curl using your commands twice now. the gem install for curb still fails in the manner I've described.

(15 Nov '11, 00:19) 3rdmartini

Getting somewhere now. Even though I've installed curl via your instructions, "curl --version" yields:

curl 7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
Protocols: tftp ftp telnet dict ldap http file https ftps 
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz

So, somehow, the new version isn't running.

(15 Nov '11, 00:24) 3rdmartini

Can you try after this command:

export PATH=$HOME/bin:$PATH

(15 Nov '11, 00:28) neeravk

That fixed it. Now my gems are installed.

However... there's a new error message in town regarding curl:

libcurl.so.4: cannot open shared object file: No such file or directory - /home/jeremyfuksa/webapps/tcn_5by5/gems/gems/curb-0.7.16/lib/curb_core.so

More path problems?

(15 Nov '11, 00:42) 3rdmartini

Yes, you would also need to add:

export LD_LIBRARY_PATH=$HOME/lib

before starting up your app.

I am sorry for not mentioning it earlier.

(15 Nov '11, 00:46) neeravk

We're past the curl problems. It's sqlite3 that's breaking now.

Installing sqlite3 (1.3.4) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /usr/local/ruby1.8.7ee/bin/ruby extconf.rb 
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... yes
checking for rb_proc_arity()... no
checking for sqlite3_initialize()... no
checking for sqlite3_backup_init()... no
checking for sqlite3_column_database_name()... no
checking for sqlite3_enable_load_extension()... no
checking for sqlite3_load_extension()... no
creating Makefile

make
gcc -I. -I. -I/usr/local/ruby1.8.7ee/lib/ruby/1.8/i686-linux -I. -D_FILE_OFFSET_BITS=64  -fPIC -g -O2    -c statement.c
statement.c: In function ‘bind_param’:
statement.c:260: error: ‘sqlite3_int64’ undeclared (first use in this function)
statement.c:260: error: (Each undeclared identifier is reported only once
statement.c:260: error: for each function it appears in.)
make: *** [statement.o] Error 1

I'm picking this up in the morning.

(15 Nov '11, 01:16) 3rdmartini

You can solve that using:

mkdir ~/src
 cd ~/src
 wget http://www.sqlite.org/sqlite-autoconf-3070800.tar.gz #sqlite3 needed for gem install
 tar -xvzf sqlite-autoconf-3070800.tar.gz
 cd sqlite-autoconf-3070800
 make
 make install
 cd
 export LD_LIBRARY_PATH=$HOME/lib
 export C_INCLUDE_PATH=$HOME/include

(15 Nov '11, 01:23) neeravk

I finally have every gem installed and am getting a totally new error:

/home/jeremyfuksa/webapps/tcn_5by5/releases/20111115155113/config/initializers/session_store.rb:3: syntax error, unexpected ':', expecting $end ...sion_store :cookie_store, key: '_tcn_5by5_session'

Research is showing that this is because I developed the app using ruby 1.9.2 and now this error is being thrown on ruby 1.8.7. I tried installing 1.9.2 via RVM on this server last night, and even though the install was successful, I could not get my nginx instance to use that version.

I can't imagine that everyone else's experience with setting up a Rails app on this service is this complicated and maddening.

(15 Nov '11, 09:57) 3rdmartini

It isn't :)

You might need to change the GEM_HOME environment variable in ~/webapps/tcn_5by5/gems/bin/start to point to whatever location your Ruby 1.9.2 is using for its gems. Be sure to restart Nginx after making that change.

If that doesn't work, then let us know exactly what command or operation is producing the new error.

(15 Nov '11, 16:05) seanf

On the upside, this has been a tremendous learning experience. :)

I was able to get ruby-1.9.2-p290 installed and running with nginx. However, now I'm back to square one with the sqlite3 gem not installing when I run 'bundle install'.

Installing sqlite3 (1.3.4) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /usr/local/ruby1.8.7ee/bin/ruby extconf.rb 
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... yes
checking for rb_proc_arity()... no
checking for sqlite3_initialize()... no
checking for sqlite3_backup_init()... no
checking for sqlite3_column_database_name()... no
checking for sqlite3_enable_load_extension()... no
checking for sqlite3_load_extension()... no
creating Makefile

make
gcc -I. -I. -I/usr/local/ruby1.8.7ee/lib/ruby/1.8/i686-linux -I. -D_FILE_OFFSET_BITS=64  -fPIC -g -O2    -c statement.c
statement.c: In function ‘bind_param’:
statement.c:260: error: ‘sqlite3_int64’ undeclared (first use in this function)
statement.c:260: error: (Each undeclared identifier is reported only once
statement.c:260: error: for each function it appears in.)
make: *** [statement.o] Error 1

looks like bundle is still using the old ruby even though 'ruby -v' shows the version I want.

(15 Nov '11, 16:12) 3rdmartini

My guess is that your /home/jeremyfuksa/webapps/tcn_5by5/bin symlink is still pointing to the old gem location, and you're running bundle from there. Try running bundle from your Ruby 1.9.2 environment's gem/bin directory instead.

(15 Nov '11, 16:23) seanf

That part is correct. Unfortunately, I got the same installer error, just with the right version of ruby being used.

(15 Nov '11, 16:27) 3rdmartini

Please try running the bundle config command shown in the accepted answer here: bundle install won't install sqlite3

(And when you run it, be sure to use the correct bundle command.)

(15 Nov '11, 16:37) seanf

Perfect. Got me past that to another Passenger error that I was able to get past. Now the site loads but yields a 500 error. Looking at the logs to figure out what's up with that.

(15 Nov '11, 16:55) 3rdmartini

So, the site is up and running finally, but one last bit of housekeeping...

When I logout and then ssh back in, I can do ruby -v and get 1.8.7 again. I had put what I thought were the right $PATH statements in my .bash_profile, but I guess I didn't. What can I do to make sure that I'm always using ruby 1.9.2-p290 when I log in?

Also, how do I change the symlink of $HOME/webapps/$APPNAME/bin to point to the 1.9.2 /bin? I tried ln -s but it didn't seem to work.

(16 Nov '11, 12:21) 3rdmartini

Regarding your PATH, you need to put your custom Ruby version at the beginning of the path, and not at the end, eg:

PATH=$HOME/webapps/app/ruby192/bin:$HOME/bin:$PATH

Regarding the symlink, what's the full command that you ran, and what sort of error did you see?

(16 Nov '11, 12:33) seanf

The PATH editing worked. Here's what I got with ln:

ln -s $HOME/webapps/tcn_5by5/ruby-1.9.2-p290/bin $HOME/webapps/tcn_5by5/bin ln: creating symbolic link '/home/jeremyfuksa/webapps/tcn_5by5/bin/bin' to '/home/jeremyfuksa/webapps/tcn_5by5/ruby-1.9.2-p290/bin': File exists

It was my understanding that I could overwrite the existing link.

(18 Nov '11, 22:42) 3rdmartini
showing 5 of 25 show 20 more comments

Fixed. I ran bundle exec rake assets:precompile RAILS_ENV=production to precompile my assets and all was fine. Site is live and running finally. Thanks to everyone for your help!

permanent link

answered 15 Nov '11, 20:17

3rdmartini
113
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×108
×108
×25
×5
×1

question asked: 14 Nov '11, 23:21

question was seen: 8,673 times

last updated: 18 Nov '11, 22:43

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM