capistrano - ERROR: Failed to build gem native extension - ruby-on-rails

i try to deploy rails app with capistrano 3, pg database, nginx and passenger i have this error
i use RVM
os: ubuntu 14.04
ruby v: 2.1.4
full error http://ec2-52-38-245-69.us-west-2.compute.amazonaws.com/
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
/home/ubuntu/.rvm/rubies/ruby-2.1.4/lib/ruby/gems/2.1.0/gems/executable-hooks-1.3.2/lib/executable-hooks/regenerate_binstubs_command.rb:71:in `initialize': Permission denied # rb_sysopen - /usr/local/bin/ri (Errno::EACCES)
from /home/ubuntu/.rvm/rubies/ruby-2.1.4/lib/ruby/gems/2.1.0/gems/executable-hooks-1.3.2/lib/executable-hooks/regenerate_binstubs_command.rb:71:in `open'
from /home/ubuntu/.rvm/rubies/ruby-2.1.4/lib/ruby/gems/2.1.0/gems/executable-hooks-1.3.2/lib/executable-hooks/regenerate_binstubs_command.rb:71:in `block in try_to_fix_binstubs'
from /home/ubuntu/.rvm/rubies/ruby-2.1.4/lib/ruby/gems/2.1.0/gems/executable-hooks-1.3.2/lib/executable-hooks/regenerate_binstubs_command.rb:69:in `map'
from /home/ubuntu/.rvm/rubies/ruby-2.1.4/lib/ruby/gems/2.1.0/gems/executable-hooks-1.3.2/lib/executable-hooks/regenerate_binstubs_command.rb:69:in `try_to_fix_binstubs'
from /home/ubuntu/.rvm/rubies/ruby-2.1.4/lib/ruby/gems/2.1.0/gems/executable-hooks-1.3.2/lib/executable-hooks/regenerate_binstubs_command.rb:46:in `block in execute_no_wrapper'
from /home/ubuntu/.rvm/rubies/ruby-2.1.4/lib/ruby/gems/2.1.0/gems/executable-hooks-1.3.2/lib/executable-hooks/regenerate_binstubs_command.rb:44:in `each'
from /home/ubuntu/.rvm/rubies/ruby-2.1.4/lib/ruby/gems/2.1.0/gems/executable-hooks-1.3.2/lib/executable-hooks/regenerate_binstubs_command.rb:44:in `execute_no_wrapper'
from extconf.rb:19:in `<main>'
bundler 1.11.2
executable-hooks 1.3.2
rake 10.1.0
rdoc 4.1.0
extconf failed, exit code 1
Gem files will remain installed in /home/ubuntu/.rvm/gems/ruby-2.1.4#global/gems/executable-hooks-1.3.2 for inspection.
Results logged to /home/ubuntu/.rvm/gems/ruby-2.1.4#global/extensions/x86_64-linux/2.1.0-static/executable-hooks-1.3.2/gem_make.out
(Gem::Ext::BuildError)
/usr/local/lib/ruby/2.1.0/rubygems/ext/builder.rb:89:in `run'
/usr/local/lib/ruby/2.1.0/rubygems/ext/ext_conf_builder.rb:38:in `block in build'
/usr/local/lib/ruby/2.1.0/tempfile.rb:324:in `open'
/usr/local/lib/ruby/2.1.0/rubygems/ext/ext_conf_builder.rb:17:in `build'
/usr/local/lib/ruby/2.1.0/rubygems/ext/builder.rb:161:in `block (2 levels) in build_extension'
/usr/local/lib/ruby/2.1.0/rubygems/ext/builder.rb:160:in `chdir'
/usr/local/lib/ruby/2.1.0/rubygems/ext/builder.rb:160:in `block in build_extension'
/usr/local/lib/ruby/2.1.0/rubygems/ext/builder.rb:159:in `synchronize'
/usr/local/lib/ruby/2.1.0/rubygems/ext/builder.rb:159:in `build_extension'
/usr/local/lib/ruby/2.1.0/rubygems/ext/builder.rb:198:in `block in build_extensions'
/usr/local/lib/ruby/2.1.0/rubygems/ext/builder.rb:195:in `each'
/usr/local/lib/ruby/2.1.0/rubygems/ext/builder.rb:195:in `build_extensions'
/usr/local/lib/ruby/2.1.0/rubygems/specification.rb:1436:in `block in build_extensions'
/usr/local/lib/ruby/2.1.0/rubygems/user_interaction.rb:45:in `use_ui'
/usr/local/lib/ruby/2.1.0/rubygems/specification.rb:1434:in `build_extensions'
/usr/local/lib/ruby/2.1.0/rubygems/stub_specification.rb:60:in `build_extensions'
/usr/local/lib/ruby/2.1.0/rubygems/basic_specification.rb:56:in `contains_requirable_file?'
/usr/local/lib/ruby/2.1.0/rubygems/specification.rb:925:in `block in find_inactive_by_path'
/usr/local/lib/ruby/2.1.0/rubygems/specification.rb:924:in `each'
/usr/local/lib/ruby/2.1.0/rubygems/specification.rb:924:in `find'
/usr/local/lib/ruby/2.1.0/rubygems/specification.rb:924:in `find_inactive_by_path'
/usr/local/lib/ruby/2.1.0/rubygems.rb:185:in `try_activate'
/usr/local/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:132:in `rescue in require'
/usr/local/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in `require'
/usr/lib/ruby/vendor_ruby/phusion_passenger/native_support.rb:423:in `load_native_extension'
/usr/lib/ruby/vendor_ruby/phusion_passenger/native_support.rb:113:in `load_from_load_path'
/usr/lib/ruby/vendor_ruby/phusion_passenger/native_support.rb:40:in `try_load'
/usr/lib/ruby/vendor_ruby/phusion_passenger/native_support.rb:50:in `start'
/usr/lib/ruby/vendor_ruby/phusion_passenger/native_support.rb:439:in `<top (required)>'
/usr/local/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/local/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/lib/ruby/vendor_ruby/phusion_passenger.rb:235:in `require_passenger_lib'
/usr/share/passenger/helper-scripts/rack-preloader.rb:76:in `init_passenger'
/usr/share/passenger/helper-scripts/rack-preloader.rb:155:in `<module:App>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<main>'

Check the user that you are deploying as has the appropriate permissions to install gems. To verify this, log into the server as that user and try to install some gems from your Gemfile.
Some gems might fail to install if they are missing system dependencies such as openssl, libxml, etc.

Related

Bundle Install Fails (Permission denied # rb_sysopen)

I am trying to run a bundle install command and I get this error. I have tried various solutions, such as changing read/write permissions, and I even uninstalled and reinstalled bundler.
I know there is a similar question here (link) but in his example, bundler actually fetched stuff and started going through the gems before dying. In my case, it just dies off the get-go.
Any insight would be much appreciated!
[wbrugato#wblaptop labels]$ bundle install
Error details
Errno::EACCES: Permission denied # rb_sysopen - /home/wbrugato/.bundle/cache/compact_index/rubygems.org.443.29b0360b937aa4d161703e6160654e47/versions
/usr/share/ruby/fileutils.rb:1393:in `initialize'
/usr/share/ruby/fileutils.rb:1393:in `open'
/usr/share/ruby/fileutils.rb:1393:in `block in copy_file'
/usr/share/ruby/fileutils.rb:1392:in `open'
/usr/share/ruby/fileutils.rb:1392:in `copy_file'
/usr/share/ruby/fileutils.rb:1360:in `copy'
/usr/share/ruby/fileutils.rb:472:in `block in copy_entry'
/usr/share/ruby/fileutils.rb:1498:in `wrap_traverse'
/usr/share/ruby/fileutils.rb:469:in `copy_entry'
/usr/share/ruby/fileutils.rb:530:in `rescue in block in mv'
/usr/share/ruby/fileutils.rb:527:in `block in mv'
/usr/share/ruby/fileutils.rb:1571:in `block in fu_each_src_dest'
/usr/share/ruby/fileutils.rb:1587:in `fu_each_src_dest0'
/usr/share/ruby/fileutils.rb:1569:in `fu_each_src_dest'
/usr/share/ruby/fileutils.rb:517:in `mv'
/home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb:55:in `block in update'
/usr/share/ruby/tmpdir.rb:89:in `mktmpdir'
/home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb:29:in `update'
/home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb:65:in `update'
/home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb:56:in `update_and_parse_checksums!'
/home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/fetcher/compact_index.rb:67:in `available?'
/home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/fetcher/compact_index.rb:15:in `call'
/home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/fetcher/compact_index.rb:15:in `block in compact_index_request'
/home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/fetcher.rb:157:in `use_api'
/home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/source/rubygems.rb:332:in `block in api_fetchers'
/home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/source/rubygems.rb:332:in `select'
/home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/source/rubygems.rb:332:in `api_fetchers'
/home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/source/rubygems.rb:337:in `block in remote_specs'
/home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/index.rb:10:in `build'
/home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/source/rubygems.rb:336:in `remote_specs'
/home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/source/rubygems.rb:83:in `specs'
/home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/lazy_specification.rb:61:in `__materialize__'
/home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/spec_set.rb:91:in `block in materialize'
/home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/spec_set.rb:88:in `map!'
/home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/spec_set.rb:88:in `materialize'
/home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/definition.rb:174:in `specs'
/home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/definition.rb:162:in `resolve_remotely!'
/home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/installer.rb:225:in `resolve_if_need'
/home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/installer.rb:78:in `run'
/home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/installer.rb:24:in `install'
/home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/cli/install.rb:71:in `run'
/home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/cli.rb:189:in `install'
/home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
/home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/cli.rb:20:in `dispatch'
/home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
/home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/cli.rb:11:in `start'
/home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/exe/bundle:34:in `block in <top (required)>'
/home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/friendly_errors.rb:100:in `with_friendly_errors'
/home/wbrugato/.gem/ruby/2.3.0/gems/bundler-1.13.7/exe/bundle:26:in `<top (required)>'
./bin/bundle:3:in `load'
./bin/bundle:3:in `<main>'
Environment
Bundler 1.13.7
Rubygems 2.6.8
Ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux]
GEM_HOME /home/wbrugato/.gem/ruby/2.3.0
GEM_PATH /home/wbrugato/.gem/ruby/2.3.0:/usr/share/gems:/usr/local/share/gems
Git 2.9.3
Bundler settings
gemfile
Set via BUNDLE_GEMFILE: "/home/wbrugato/RubymineProjects/labels/Gemfile"
I had a similar issue. Clearing the bundler's cache worked for me.
rm -rf ~/.bundle/cache

Bundler uses wrong path to ruby

I have some problems running bundle install. I get messages like Errno::EACCES: Permission denied # rb_sysopen - /bundler_cache/extensions/x86_64-linux/2.3.0-static/ffi-1.9.10/gem_make.out and running bundle install --verbose showed me such output:
Errno::EACCES: Permission denied # rb_sysopen - /bundler_cache/extensions/x86_64-linux/2.3.0-static/debug_inspector-0.0.2/gem_make.out
/usr/local/lib/ruby/2.3.0/open-uri.rb:37:in `initialize'
/usr/local/lib/ruby/2.3.0/open-uri.rb:37:in `open'
/usr/local/lib/ruby/2.3.0/open-uri.rb:37:in `open'
/usr/local/lib/ruby/site_ruby/2.3.0/rubygems/ext/builder.rb:215:in `write_gem_make_out'
/usr/local/lib/ruby/site_ruby/2.3.0/rubygems/ext/builder.rb:135:in `build_error'
/usr/local/lib/ruby/site_ruby/2.3.0/rubygems/ext/builder.rb:174:in `rescue in build_extension'
/usr/local/lib/ruby/site_ruby/2.3.0/rubygems/ext/builder.rb:159:in `build_extension'
/usr/local/lib/ruby/site_ruby/2.3.0/rubygems/ext/builder.rb:201:in `block in build_extensions'
/usr/local/lib/ruby/site_ruby/2.3.0/rubygems/ext/builder.rb:198:in `each'
/usr/local/lib/ruby/site_ruby/2.3.0/rubygems/ext/builder.rb:198:in `build_extensions'
/usr/local/lib/ruby/site_ruby/2.3.0/rubygems/installer.rb:747:in `build_extensions'
/usr/local/lib/ruby/site_ruby/2.3.0/rubygems/installer.rb:299:in `install'
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/source/rubygems.rb:143:in `block in install'
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/rubygems_integration.rb:169:in `preserve_paths'
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/source/rubygems.rb:135:in `install'
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/installer/gem_installer.rb:57:in `install'
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/installer/gem_installer.rb:15:in `install_from_spec'
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/installer/parallel_installer.rb:91:in `block in worker_pool'
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/worker.rb:65:in `apply_func'
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/worker.rb:60:in `block in process_queue'
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/worker.rb:57:in `loop'
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/worker.rb:57:in `process_queue'
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/worker.rb:29:in `block (2 levels) in initialize'
That output makes me worry: I use ruby 2.3.1, it is also specified in Gemfile. And bundler doesn't try to say that I use a wrong version, like it usually does. It just silently do it.
Is it wrong path, or it ok? What should I do?
ruby -v obviously provides not 2.3.0 but ruby 2.3.1p112

Bundle Install Permission Denied Error

I have just cloned a project to start playing around with. Getting the error below. I have exhausted the other answers on here as none of them seemed to cure the problem. I am only just getting started with web dev so bare with with me. Any suggestions or help is greatly appreciated.
I have been through the bundler troubleshooting and tried the fixes they suggest without any joy...
Patricks-MacBook-Pro:ytutorial patrickwalsh$ bundle install
Unfortunately, a fatal error has occurred. Please see the Bundler troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:245:in `mkdir': Permission denied - /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-13/2.0.0/kgio-2.7.4 (Errno::EACCES)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:245:in `fu_mkdir'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:219:in `block (2 levels) in mkdir_p'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:217:in `reverse_each'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:217:in `block in mkdir_p'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:203:in `each'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:203:in `mkdir_p'
from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:210:in `write_gem_make_out'
from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:132:in `build_error'
from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:171:in `rescue in build_extension'
from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:156:in `build_extension'
from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:198:in `block in build_extensions'
from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:195:in `each'
from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:195:in `build_extensions'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1436:in `block in build_extensions'
from /Library/Ruby/Site/2.0.0/rubygems/user_interaction.rb:45:in `use_ui'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1434:in `build_extensions'
from /Library/Ruby/Site/2.0.0/rubygems/stub_specification.rb:60:in `build_extensions'
from /Library/Ruby/Site/2.0.0/rubygems/basic_specification.rb:56:in `contains_requirable_file?'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:925:in `block in find_inactive_by_path'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:924:in `each'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:924:in `find'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:924:in `find_inactive_by_path'
from /Library/Ruby/Site/2.0.0/rubygems.rb:185:in `try_activate'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:132:in `rescue in require'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:144:in `require'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.5.3/lib/bundler/vendor/net/http/persistent.rb:12:in `<top (required)>'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.5.3/lib/bundler/vendored_persistent.rb:3:in `<top (required)>'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.5.3/lib/bundler/fetcher.rb:1:in `<top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.5.3/lib/bundler/cli.rb:247:in `install'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.5.3/lib/bundler/vendor/thor/command.rb:27:in `run'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.5.3/lib/bundler/vendor/thor/invocation.rb:121:in `invoke_command'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.5.3/lib/bundler/vendor/thor.rb:363:in `dispatch'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.5.3/lib/bundler/vendor/thor/base.rb:440:in `start'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.5.3/lib/bundler/cli.rb:10:in `start'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.5.3/bin/bundle:20:in `block in <top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.5.3/lib/bundler/friendly_errors.rb:5:in `with_friendly_errors'
from /Library/Ruby/Gems/2.0.0/gems/bundler-1.5.3/bin/bundle:20:in `<top (required)>'
from /usr/bin/bundle:23:in `load'
from /usr/bin/bundle:23:in `<main>'
sudo bundle install
You gem is install in System. Change path in bash file. And it will solve the issues. You simply enter,
bundle install.
Use sudo bundle install. Looks like issue with permissions on your system.
Do you have permissions to write on /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-13/2.0.0/kgio-2.7.4 directory.
The error logs states that it tries to create a dir (with mkdir) and the permission is denied!
Can you do # bundle install has root?

ruby on rails bundle command error

I install rvm ( Multiuser install : \curl -L https://get.rvm.io | sudo bash -s stable)
and I added user to rvm group
and I typping 'rails new testprj'
But i have an error message, It is same typping 'bundle' command errer message
How do i do?
I'm really sorry my english...
kitty#ubuntu:~/workspace/rails$ bundle
Unfortunately, a fatal error has occurred. Please see the Bundler troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
/usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tmpdir.rb:85:in `mkdir': ERROR: Failed to build gem native extension. (Gem::Ext::BuildError)
Permission denied # dir_s_mkdir - ./.gem.20140211-10050-1th152x
Gem files will remain installed in /usr/local/rvm/gems/ruby-2.1.0/gems/sqlite3-1.3.8 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.1.0/extensions/x86_64-linux/2.1.0/sqlite3-1.3.8/gem_make.out
from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tmpdir.rb:85:in `block in mktmpdir'
from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tmpdir.rb:142:in `create'
from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tmpdir.rb:85:in `mktmpdir'
from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/ext/ext_conf_builder.rb:14:in `build'
from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/ext/builder.rb:161:in `block (2 levels) in build_extension'
from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/ext/builder.rb:160:in `chdir'
from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/ext/builder.rb:160:in `block in build_extension'
from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/ext/builder.rb:159:in `synchronize'
from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/ext/builder.rb:159:in `build_extension'
from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/ext/builder.rb:198:in `block in build_extensions'
from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/ext/builder.rb:195:in `each'
from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/ext/builder.rb:195:in `build_extensions'
from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:1436:in `block in build_extensions'
from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/user_interaction.rb:45:in `use_ui'
from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:1434:in `build_extensions'
from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/stub_specification.rb:60:in `build_extensions'
from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/basic_specification.rb:56:in `contains_requirable_file?'
from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:925:in `block in find_inactive_by_path'
from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:924:in `each'
from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:924:in `find'
from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:924:in `find_inactive_by_path'
from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems.rb:185:in `try_activate'
from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:132:in `rescue in require'
from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in `require'
from /usr/local/rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.3/lib/bundler/vendor/net/http/persistent.rb:12:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.3/lib/bundler/vendored_persistent.rb:3:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/rvm/rubies/ruby-2.1.0/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.3/lib/bundler/fetcher.rb:1:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.3/lib/bundler/cli.rb:247:in `install'
from /usr/local/rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.3/lib/bundler/vendor/thor/command.rb:27:in `run'
from /usr/local/rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.3/lib/bundler/vendor/thor/invocation.rb:121:in `invoke_command'
from /usr/local/rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.3/lib/bundler/vendor/thor.rb:363:in `dispatch'
from /usr/local/rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.3/lib/bundler/vendor/thor/base.rb:440:in `start'
from /usr/local/rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.3/lib/bundler/cli.rb:10:in `start'
from /usr/local/rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.3/bin/bundle:20:in `block in <top (required)>'
from /usr/local/rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.3/lib/bundler/friendly_errors.rb:5:in `with_friendly_errors'
from /usr/local/rvm/gems/ruby-2.1.0#global/gems/bundler-1.5.3/bin/bundle:20:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.1.0#global/bin/bundle:23:in `load'
from /usr/local/rvm/gems/ruby-2.1.0#global/bin/bundle:23:in `<main>'
from /usr/local/rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15:in `eval'
from /usr/local/rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15:in `<main>'
DO NOT USE SU TO CREATE A NEW PROJECT
Sorry, but I cannot stress this enough, it's even mentioned in most guides.
The problem is Rubygems most likely.
try running the following command.
sudo gem update --system --no-user-install.
My guess is that you originally installed this somewhere in local directory which bundler cannot access. Updating the system version and setting it as default again will hopefully get you around this.

bundle update fails : marshal data too short

$ bundle update
Fetching gem metadata from http://rubygems.org/..Unfortunately, a fatal error has occurred. Please see the Bundler
troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
/Users/macbook/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/lib/bundler/fetcher.rb:168:in `load': marshal data too short (ArgumentError)
from /Users/macbook/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/lib/bundler/fetcher.rb:168:in `fetch_dependency_remote_specs'
from /Users/macbook/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/lib/bundler/fetcher.rb:125:in `fetch_remote_specs'
from /Users/macbook/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/lib/bundler/fetcher.rb:128:in `fetch_remote_specs'
from /Users/macbook/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/lib/bundler/fetcher.rb:73:in `specs'
from /Users/macbook/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/lib/bundler/source.rb:234:in `block in remote_specs'
from /Users/macbook/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/lib/bundler/source.rb:232:in `each'
from /Users/macbook/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/lib/bundler/source.rb:232:in `remote_specs'
from /Users/macbook/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/lib/bundler/source.rb:165:in `fetch_specs'
from /Users/macbook/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/lib/bundler/source.rb:70:in `specs'
from /Users/macbook/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/lib/bundler/definition.rb:191:in `block (2 levels) in index'
from /Users/macbook/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/lib/bundler/definition.rb:188:in `each'
from /Users/macbook/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/lib/bundler/definition.rb:188:in `block in index'
from /Users/macbook/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/lib/bundler/index.rb:9:in `build'
from /Users/macbook/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/lib/bundler/definition.rb:184:in `index'
from /Users/macbook/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/lib/bundler/definition.rb:178:in `resolve'
from /Users/macbook/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/lib/bundler/definition.rb:113:in `specs'
from /Users/macbook/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/lib/bundler/definition.rb:108:in `resolve_remotely!'
from /Users/macbook/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/lib/bundler/installer.rb:81:in `run'
from /Users/macbook/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/lib/bundler/installer.rb:14:in `install'
from /Users/macbook/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/lib/bundler/cli.rb:291:in `update'
from /Users/macbook/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/lib/bundler/vendor/thor/task.rb:27:in `run'
from /Users/macbook/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/lib/bundler/vendor/thor/invocation.rb:120:in `invoke_task'
from /Users/macbook/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/lib/bundler/vendor/thor.rb:275:in `dispatch'
from /Users/macbook/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/lib/bundler/vendor/thor/base.rb:408:in `start'
from /Users/macbook/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/bin/bundle:14:in `block in <top (required)>'
from /Users/macbook/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/lib/bundler/friendly_errors.rb:4:in `with_friendly_errors'
from /Users/macbook/.rvm/gems/ruby-1.9.3-p374#global/gems/bundler-1.2.3/bin/bundle:14:in `<top (required)>'
from /Users/macbook/.rvm/gems/ruby-1.9.3-p374#global/bin/bundle:19:in `load'
from /Users/macbook/.rvm/gems/ruby-1.9.3-p374#global/bin/bundle:19:in `<main>'
from /Users/macbook/.rvm/gems/ruby-1.9.3-p374#global/bin/ruby_noexec_wrapper:14:in `eval'
from /Users/macbook/.rvm/gems/ruby-1.9.3-p374#global/bin/ruby_noexec_wrapper:14:in `<main>'
Try to change from HTTP to HTTPS in your Gemfile:
Change:
source 'http://rubygems.org'
To:
source 'https://rubygems.org'
Acording this article from Hacker News, Rubygems.org was compromised.
More info: Marshal data too short error and https for rubygems.org in the Gemfile?
$ gem list
*** LOCAL GEMS ***
bundler (1.2.3)
....
$ sudo gem install bundler
Password:
Fetching: bundler-1.2.3.gem (100%)
Successfully installed bundler-1.2.3
1 gem installed
$ bundle update
Fetching gem metadata from http://rubygems.org/.........
Installing.....
.... .... .....
Your bundle is updated!
I had the same error (under rvm). It went away after:
rvm repair all
Hope this helps.

Resources