Here is my code and output in console:
root@a:/home/rails/car_main# bundle install
You have requested:
rails = 4.2
The bundle currently has rails locked at 4.0.2.
Try running `bundle update rails`
Here is what I did and output:
root@a:/home/rails/car_main# bundle update rails
Fetching gem metadata from https://rubygems.org/.........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies............
Using rake 10.5.0
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.8.4 (was 4.7.5)
Using thread_safe 0.3.5
Using builder 3.2.2 (was 3.1.4)
Using erubis 2.7.0
Using mini_portile2 2.0.0
Using rack 1.6.4 (was 1.5.5)
Using mime-types 2.99 (was 1.25.1)
Using arel 6.0.3 (was 4.0.2)
Installing bcrypt 3.1.10 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /usr/local/rvm/gems/ruby-2.3.0/gems/bcrypt-3.1.10/ext/mri
/usr/local/rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160218-3939-e5ct6z.rb extconf.rb
Cannot allocate memory - /usr/local/rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160218-3939-e5ct6z.rb extconf.rb 2>&1
Gem files will remain installed in /usr/local/rvm/gems/ruby-2.3.0/gems/bcrypt-3.1.10 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/bcrypt-3.1.10/gem_make.out
Installing bcrypt-ruby 3.1.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /usr/local/rvm/gems/ruby-2.3.0/gems/bcrypt-ruby-3.1.2/ext/mri
/usr/local/rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160218-3939-e88mem.rb extconf.rb
Cannot allocate memory - /usr/local/rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160218-3939-e88mem.rb extconf.rb 2>&1
Gem files will remain installed in /usr/local/rvm/gems/ruby-2.3.0/gems/bcrypt-ruby-3.1.2 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/bcrypt-ruby-3.1.2/gem_make.out
Using coffee-script-source 1.10.0
Using execjs 2.6.0
Using thor 0.19.1
Using bundler 1.11.2
Using hike 1.2.3
Using multi_json 1.11.2
Using tilt 1.4.1
Using sass 3.4.21
Using will_paginate 3.0.4
Installing ffi 1.9.10 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /usr/local/rvm/gems/ruby-2.3.0/gems/ffi-1.9.10/ext/ffi_c
/usr/local/rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160218-3939-u62vla.rb extconf.rb
Cannot allocate memory - /usr/local/rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160218-3939-u62vla.rb extconf.rb 2>&1
Gem files will remain installed in /usr/local/rvm/gems/ruby-2.3.0/gems/ffi-1.9.10 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/ffi-1.9.10/gem_make.out
Using diff-lcs 1.2.5
Installing unf_ext 0.0.7.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /usr/local/rvm/gems/ruby-2.3.0/gems/unf_ext-0.0.7.1/ext/unf_ext
/usr/local/rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160218-3939-1n8ty2l.rb extconf.rb
Cannot allocate memory - /usr/local/rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160218-3939-1n8ty2l.rb extconf.rb 2>&1
Gem files will remain installed in /usr/local/rvm/gems/ruby-2.3.0/gems/unf_ext-0.0.7.1 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/unf_ext-0.0.7.1/gem_make.out
Using ffaker 2.1.0
After this when I type bundle install I still get the error
Okay. What do I do with memory? I use digital ocean droplet for $5 my website is quite simple. I did what suggested here in this question: https://askubuntu.com/questions/253466/why-am-i-frequently-getting-this-cannot-allocate-memory-error here is output:
root@a:/home/rails/car_main# ps --sort -rss -eo rss,pid,command | head
RSS PID COMMAND
75920 1538 unicorn worker[0] -D -c /etc/unicorn.conf -E production
74176 1541 unicorn worker[1] -D -c /etc/unicorn.conf -E production
73988 1543 unicorn worker[2] -D -c /etc/unicorn.conf -E production
73828 1546 unicorn worker[3] -D -c /etc/unicorn.conf -E production
11972 1057 /usr/lib/postgresql/9.3/bin/postgres -D /var/lib/postgresql/9.3/main -c config_file=/etc/postgresql/9.3/main/postgresql.conf
10464 1535 unicorn master -D -c /etc/unicorn.conf -E production
7508 4037 postgres: rails rails_project_production 127.0.0.1(56865) idle
6788 1630 -bash
5732 1563 postgres: rails rails_project_production 127.0.0.1(56745) idle
UPDATE2:
I print this as suggested in comments link
root@a:/home/rails/car_main# sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
Problem still exist.
I will try to stop postgres now
Update 3
I tried to stop and start postgres( I am not sure if I googled how to this correctly so here the code and output:
root@a:/usr/bin# /etc/init.d/postgresql stop
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_TIME = "ru_RU.UTF-8",
LC_MONETARY = "ru_RU.UTF-8",
LC_ADDRESS = "ru_RU.UTF-8",
LC_TELEPHONE = "ru_RU.UTF-8",
LC_NAME = "ru_RU.UTF-8",
LC_MEASUREMENT = "ru_RU.UTF-8",
LC_IDENTIFICATION = "ru_RU.UTF-8",
LC_NUMERIC = "ru_RU.UTF-8",
LC_PAPER = "ru_RU.UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
* Stopping PostgreSQL 9.3 database server [ OK ]
root@a:/usr/bin# /etc/init.d/postgresql start
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_TIME = "ru_RU.UTF-8",
LC_MONETARY = "ru_RU.UTF-8",
LC_ADDRESS = "ru_RU.UTF-8",
LC_TELEPHONE = "ru_RU.UTF-8",
LC_NAME = "ru_RU.UTF-8",
LC_MEASUREMENT = "ru_RU.UTF-8",
LC_IDENTIFICATION = "ru_RU.UTF-8",
LC_NUMERIC = "ru_RU.UTF-8",
LC_PAPER = "ru_RU.UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
* Starting PostgreSQL 9.3 database server * perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_TIME = "ru_RU.UTF-8",
LC_MONETARY = "ru_RU.UTF-8",
LC_ADDRESS = "ru_RU.UTF-8",
LC_TELEPHONE = "ru_RU.UTF-8",
LC_NAME = "ru_RU.UTF-8",
LC_MEASUREMENT = "ru_RU.UTF-8",
LC_IDENTIFICATION = "ru_RU.UTF-8",
LC_NUMERIC = "ru_RU.UTF-8",
LC_PAPER = "ru_RU.UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
The PostgreSQL server failed to start. Please check the log output:
2016-02-18 12:42:32 EST FATAL: could not map anonymous shared memory: Cannot allocate memory
2016-02-18 12:42:32 EST HINT: This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory or swap space. To reduce the request size (currently 147783680 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections.
UPDATE 4:
I print htop: here is the output:
What processes should I kill?
Update 5:
I ran once again bundle update
Then I got some error and promt to install bundler so I installed it with
root@a:/home/rails/car_main# apt-get install bundler
Then I did once again bundle update:
root@a:/home/rails/car_main# bundle update
/usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- bundler (LoadError)
from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/bin/bundle:7:in `<main>'
UPDATE 6: So I run bundle update once again and it gave me an error that cannot install sqlite3 and suggested to install it manually so i did it and here's the output:
root@a:/home/rails/car_main# gem install sqlite3 -v '1.3.8'
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
current directory: /usr/local/rvm/gems/ruby-2.3.0@railstutorial_rails_4_0/gems/sqlite3-1.3.8/ext/sqlite3
/usr/local/rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160218-26242-ueiluc.rb extconf.rb
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... yes
checking for rb_proc_arity()... yes
checking for sqlite3_initialize()... yes
checking for sqlite3_backup_init()... yes
checking for sqlite3_column_database_name()... yes
checking for sqlite3_enable_load_extension()... yes
checking for sqlite3_load_extension()... yes
checking for sqlite3_open_v2()... yes
checking for sqlite3_prepare_v2()... yes
checking for sqlite3_int64 in sqlite3.h... yes
checking for sqlite3_uint64 in sqlite3.h... yes
creating Makefile
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/usr/local/rvm/gems/ruby-2.3.0@railstutorial_rails_4_0/extensions/x86_64-linux/2.3.0/sqlite3-1.3.8/mkmf.log
current directory: /usr/local/rvm/gems/ruby-2.3.0@railstutorial_rails_4_0/gems/sqlite3-1.3.8/ext/sqlite3
make "DESTDIR=" clean
current directory: /usr/local/rvm/gems/ruby-2.3.0@railstutorial_rails_4_0/gems/sqlite3-1.3.8/ext/sqlite3
make "DESTDIR="
compiling database.c
compiling backup.c
compiling exception.c
compiling statement.c
statement.c: In function ‘bind_param’:
statement.c:261:7: warning: implicit declaration of function ‘RBIGNUM’ [-Wimplicit-function-declaration]
if (RBIGNUM_LEN(value) * SIZEOF_BDIGITS <= 8) {
^
In file included from statement.c:1:0:
./sqlite3_ruby.h:16:34: error: invalid type argument of ‘->’ (have ‘int’)
#define RBIGNUM_LEN(x) RBIGNUM(x)->len
^
statement.c:261:11: note: in expansion of macro ‘RBIGNUM_LEN’
if (RBIGNUM_LEN(value) * SIZEOF_BDIGITS <= 8) {
^
statement.c:261:32: error: ‘SIZEOF_BDIGITS’ undeclared (first use in this function)
if (RBIGNUM_LEN(value) * SIZEOF_BDIGITS <= 8) {
^
statement.c:261:32: note: each undeclared identifier is reported only once for each function it appears in
statement.c: In function ‘reset_bang’:
statement.c:293:7: warning: variable ‘status’ set but not used [-Wunused-but-set-variable]
int status;
^
statement.c: In function ‘clear_bindings’:
statement.c:313:7: warning: variable ‘status’ set but not used [-Wunused-but-set-variable]
int status;
^
make: *** [statement.o] Error 1
make failed, exit code 2
Gem files will remain installed in /usr/local/rvm/gems/ruby-2.3.0@railstutorial_rails_4_0/gems/sqlite3-1.3.8 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.3.0@railstutorial_rails_4_0/extensions/x86_64-linux/2.3.0/sqlite3-1.3.8/gem_make.out
I will remove sqlite version in gemfile hope it helps