login community 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:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
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 Nov 14 '11 at 23:21

3rdmartini's gravatar image

3rdmartini
13

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/
(Nov 14 '11 at 23:32) neeravk ♦♦ neeravk's gravatar image

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

(Nov 14 '11 at 23:33) 3rdmartini 3rdmartini's gravatar image

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

(Nov 14 '11 at 23:36) neeravk ♦♦ neeravk's gravatar image

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)

(Nov 14 '11 at 23:42) 3rdmartini 3rdmartini's gravatar image

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.

(Nov 14 '11 at 23:50) neeravk ♦♦ neeravk's gravatar image

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

(Nov 15 '11 at 00:00) 3rdmartini 3rdmartini's gravatar image

Log for the gem make:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
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 functionInit_curb_core:
curb.c:366: error:CURLOPT_SEEKFUNCTIONundeclared (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_SEEKDATAundeclared (first use in this function)
curb.c:368: error:CURLOPT_SOCKOPTFUNCTIONundeclared (first use in this function)
curb.c:369: error:CURLOPT_SOCKOPTDATAundeclared (first use in this function)
curb.c:370: error:CURLOPT_OPENSOCKETFUNCTIONundeclared (first use in this function)
curb.c:371: error:CURLOPT_OPENSOCKETDATAundeclared (first use in this function)
make: *** [curb.o] Error 1
(Nov 15 '11 at 00:05) 3rdmartini 3rdmartini's gravatar image

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

(Nov 15 '11 at 00:15) neeravk ♦♦ neeravk's gravatar image

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

(Nov 15 '11 at 00:19) 3rdmartini 3rdmartini's gravatar image

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

1
2
3
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.

(Nov 15 '11 at 00:24) 3rdmartini 3rdmartini's gravatar image

Can you try after this command:

export PATH=$HOME/bin:$PATH

(Nov 15 '11 at 00:28) neeravk ♦♦ neeravk's gravatar image

That fixed it. Now my gems are installed.

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

1
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?

(Nov 15 '11 at 00:42) 3rdmartini 3rdmartini's gravatar image

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.

(Nov 15 '11 at 00:46) neeravk ♦♦ neeravk's gravatar image

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
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 functionbind_param:
statement.c:260: error:sqlite3_int64undeclared (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.

(Nov 15 '11 at 01:16) 3rdmartini 3rdmartini's gravatar image

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

(Nov 15 '11 at 01:23) neeravk ♦♦ neeravk's gravatar image

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

1
/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.

(Nov 15 '11 at 09:57) 3rdmartini 3rdmartini's gravatar image

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.

(Nov 15 '11 at 16:05) seanf ♦♦ seanf's gravatar image

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'.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
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 functionbind_param:
statement.c:260: error:sqlite3_int64undeclared (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.

(Nov 15 '11 at 16:12) 3rdmartini 3rdmartini's gravatar image

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.

(Nov 15 '11 at 16:23) seanf ♦♦ seanf's gravatar image

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

(Nov 15 '11 at 16:27) 3rdmartini 3rdmartini's gravatar image

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.)

(Nov 15 '11 at 16:37) seanf ♦♦ seanf's gravatar image

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.

(Nov 15 '11 at 16:55) 3rdmartini 3rdmartini's gravatar image

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.

(Nov 16 '11 at 12:21) 3rdmartini 3rdmartini's gravatar image

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

1
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?

(Nov 16 '11 at 12:33) seanf ♦♦ seanf's gravatar image

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.

(Nov 18 '11 at 22:42) 3rdmartini 3rdmartini's gravatar image
showing 5 of 25 show all

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!

answered Nov 15 '11 at 20:17

3rdmartini's gravatar image

3rdmartini
13

Your answer
If you have an answer to the above question, then use the form below. Otherwise, use the appropriate 'add new comment' button above to post your feedback.
toggle preview

Plans & prices    Sign up    Why WebFaction?    Contact us    Affiliate program    Support    Legal    Jobs    Blog    Control panel login
Powered by OSQA
© Copyright 2003-2012 Swarma Limited - WebFaction is a service of Swarma Limited