无法在本地使用工头运行ruby应用程序

时间:2014-01-20 09:13:53

标签: ruby heroku foreman

我有一个名为" Aadvisor"的应用程序,当我尝试在本地运行此应用程序时,我会执行foreman start,如下所示:

pallav@pallav-System-Product-Name:~/Workspace/Aadvisor$ foreman start
14:21:28 web.1  | started with pid 14635
14:21:28 web.1  | bundler: command not found: rackup
14:21:28 web.1  | Install missing gem executables with `bundle install`
14:21:29 web.1  | exited with code 127
14:21:29 system | sending SIGTERM to all processes
SIGTERM received

然后我做'捆绑安装' :

pallav@pallav-System-Product-Name:~/Workspace/Aadvisor$ bundle install
Fetching gem metadata from http://rubygems.org/.........
Fetching additional metadata from http://rubygems.org/..
Resolving dependencies...
Using addressable (2.3.5)
Using backports (3.4.0)

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /usr/bin/ruby1.9.1 extconf.rb 
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
    from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from extconf.rb:13:in `<main>'


Gem files will remain installed in /home/pallav/Workspace/Aadvisor/vendor/bundle/ruby/1.9.1/gems/bcrypt-ruby-3.1.2 for inspection.
Results logged to /home/pallav/Workspace/Aadvisor/vendor/bundle/ruby/1.9.1/gems/bcrypt-ruby-3.1.2/ext/mri/gem_make.out
An error occurred while installing bcrypt-ruby (3.1.2), and Bundler cannot continue.
Make sure that `gem install bcrypt-ruby -v '3.1.2'` succeeds before bundling.

然后我只需执行gem install bcrypt-ruby -v '3.1.2',如下所示:

pallav@pallav-System-Product-Name:~/Workspace/Aadvisor$ gem install bcrypt-ruby -v '3.1.2'
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions into the /var/lib/gems/1.9.1 directory.

然后使用&#39; sudo&#39; sudo gem install bcrypt-ruby -v '3.1.2',如下所示:

pallav@pallav-System-Product-Name:~/Workspace/Aadvisor$ sudo gem install bcrypt-ruby -v '3.1.2'
[sudo] password for pallav: 
Building native extensions.  This could take a while...
ERROR:  Error installing bcrypt-ruby:
    ERROR: Failed to build gem native extension.

        /usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
    from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from extconf.rb:13:in `<main>'


Gem files will remain installed in /var/lib/gems/1.9.1/gems/bcrypt-ruby-3.1.2 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/bcrypt-ruby-3.1.2/ext/mri/gem_make.out

我在这里检查了错误日志:

pallav@pallav-System-Product-Name:~/Workspace/Aadvisor$ /var/lib/gems/1.9.1/gems/bcrypt-ruby-3.1.2/ext/mri/gem_make.out
bash: /var/lib/gems/1.9.1/gems/bcrypt-ruby-3.1.2/ext/mri/gem_make.out: Permission denied

我的红宝石版本是:

pallav@pallav-System-Product-Name:~/Workspace/Aadvisor$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

我的Gem文件是:

source "http://rubygems.org"

 gem "rack" 
 gem "sinatra" 
 gem "sinatra-contrib" 
 gem "json" 
 gem "will_paginate" 
 gem 'will_paginate-bootstrap'

 gem "thin"
 #gem "shotgun"

 gem 'pg'

 gem "data_mapper" 
 gem "dm-postgres-adapter" 
 gem "dm-validations"

我确实安装了rvm \curl -sSL https://get.rvm.io | bash并且之后又sudo apt-get install ruby1.9.1-dev我再次尝试bundle install并且我得到了这个:

pallav@pallav-System-Product-Name:~/Workspace/Aadvisor$ bundle install
Fetching source index from http://rubygems.org/
Resolving dependencies................................
Using addressable (2.3.5)
Using backports (3.4.0)
Installing bcrypt-ruby (3.1.2)
Installing daemons (1.1.9)
Installing dm-core (1.2.1)
Installing dm-aggregates (1.2.0)
Installing dm-constraints (1.2.0)
Installing dm-migrations (1.2.0)
Installing fastercsv (1.5.5)
Installing json (1.8.1)
Installing json_pure (1.8.1)
Installing multi_json (1.8.4)
Installing dm-serializer (1.2.2)
Installing dm-timestamps (1.2.0)
Installing dm-transactions (1.2.0)
Installing stringex (1.5.1)
Installing uuidtools (2.1.4)
Installing dm-types (1.2.2)
Installing dm-validations (1.2.0)
Installing data_mapper (1.2.0)
Installing data_objects (0.10.13)
Installing dm-do-adapter (1.2.0)

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /usr/bin/ruby1.9.1 extconf.rb 
checking for main() in -lpq... no
checking for main() in -llibpq... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/bin/ruby1.9.1
    --with-pgsql-server-dir
    --without-pgsql-server-dir
    --with-pgsql-server-include
    --without-pgsql-server-include=${pgsql-server-dir}/include
    --with-pgsql-server-lib
    --without-pgsql-server-lib=${pgsql-server-dir}/lib
    --with-pgsql-client-dir
    --without-pgsql-client-dir
    --with-pgsql-client-include
    --without-pgsql-client-include=${pgsql-client-dir}/include
    --with-pgsql-client-lib
    --without-pgsql-client-lib=${pgsql-client-dir}/lib
    --with-pqlib
    --without-pqlib
    --with-libpqlib
    --without-libpqlib
Could not find PostgreSQL build environment (libraries & headers): Makefile not created


Gem files will remain installed in /home/pallav/Workspace/Aadvisor/vendor/bundle/ruby/1.9.1/gems/do_postgres-0.10.13 for inspection.
Results logged to /home/pallav/Workspace/Aadvisor/vendor/bundle/ruby/1.9.1/gems/do_postgres-0.10.13/ext/do_postgres/gem_make.out
An error occurred while installing do_postgres (0.10.13), and Bundler cannot continue.
Make sure that `gem install do_postgres -v '0.10.13'` succeeds before bundling.

我也尝试像这样安装gem install do_postgres -v '0.10.13'

pallav@pallav-System-Product-Name:~/Workspace/Aadvisor$ sudo gem install do_postgres -v '0.10.13'
Fetching: data_objects-0.10.13.gem (100%)
Fetching: do_postgres-0.10.13.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing do_postgres:
    ERROR: Failed to build gem native extension.

        /usr/bin/ruby1.9.1 extconf.rb
checking for main() in -lpq... no
checking for main() in -llibpq... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/bin/ruby1.9.1
    --with-pgsql-server-dir
    --without-pgsql-server-dir
    --with-pgsql-server-include
    --without-pgsql-server-include=${pgsql-server-dir}/include
    --with-pgsql-server-lib
    --without-pgsql-server-lib=${pgsql-server-dir}/lib
    --with-pgsql-client-dir
    --without-pgsql-client-dir
    --with-pgsql-client-include
    --without-pgsql-client-include=${pgsql-client-dir}/include
    --with-pgsql-client-lib
    --without-pgsql-client-lib=${pgsql-client-dir}/lib
    --with-pqlib
    --without-pqlib
    --with-libpqlib
    --without-libpqlib
Could not find PostgreSQL build environment (libraries & headers): Makefile not created


Gem files will remain installed in /var/lib/gems/1.9.1/gems/do_postgres-0.10.13 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/do_postgres-0.10.13/ext/do_postgres/gem_make.out

最后我将结果检查为:

pallav@pallav-System-Product-Name:~/Workspace/Aadvisor$ /var/lib/gems/1.9.1/gems/do_postgres-0.10.13/ext/do_postgres/gem_make.out
bash: /var/lib/gems/1.9.1/gems/do_postgres-0.10.13/ext/do_postgres/gem_make.out: Permission denied

可能是错误。

0 个答案:

没有答案