Al D
Al D

Reputation: 667

Ruby on Rails bundle command not working

All of a sudden I'm no longer able to run the bundle command in my project. I'm using Ubuntu for development and was following a tutorial on how to deploy to Azure.

When I cd to my project directory and runn bundle I get the following message:-

Unfortunately, a fatal error has occurred. Please see the Bundler
troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
/usr/lib/ruby/2.1.0/fileutils.rb:250:in `mkdir': Permission denied @ dir_s_mkdir - /var/lib/gems/2.1.0/extensions/x86-linux/2.1.0/kgio-2.9.2 (Errno::EACCES)
    from /usr/lib/ruby/2.1.0/fileutils.rb:250:in `fu_mkdir'
    from /usr/lib/ruby/2.1.0/fileutils.rb:224:in `block (2 levels) in mkdir_p'
    from /usr/lib/ruby/2.1.0/fileutils.rb:222:in `reverse_each'
    from /usr/lib/ruby/2.1.0/fileutils.rb:222:in `block in mkdir_p'
    from /usr/lib/ruby/2.1.0/fileutils.rb:208:in `each'
    from /usr/lib/ruby/2.1.0/fileutils.rb:208:in `mkdir_p'
    from /usr/lib/ruby/2.1.0/rubygems/ext/builder.rb:210:in `write_gem_make_out'
    from /usr/lib/ruby/2.1.0/rubygems/ext/builder.rb:132:in `build_error'
    from /usr/lib/ruby/2.1.0/rubygems/ext/builder.rb:171:in `rescue in build_extension'
    from /usr/lib/ruby/2.1.0/rubygems/ext/builder.rb:156:in `build_extension'
    from /usr/lib/ruby/2.1.0/rubygems/ext/builder.rb:198:in `block in build_extensions'
    from /usr/lib/ruby/2.1.0/rubygems/ext/builder.rb:195:in `each'
    from /usr/lib/ruby/2.1.0/rubygems/ext/builder.rb:195:in `build_extensions'
    from /usr/lib/ruby/2.1.0/rubygems/specification.rb:1436:in `block in build_extensions'
    from /usr/lib/ruby/2.1.0/rubygems/user_interaction.rb:45:in `use_ui'
    from /usr/lib/ruby/2.1.0/rubygems/specification.rb:1434:in `build_extensions'
    from /usr/lib/ruby/2.1.0/rubygems/stub_specification.rb:60:in `build_extensions'
    from /usr/lib/ruby/2.1.0/rubygems/basic_specification.rb:56:in `contains_requirable_file?'
    from /usr/lib/ruby/2.1.0/rubygems/specification.rb:925:in `block in find_inactive_by_path'
    from /usr/lib/ruby/2.1.0/rubygems/specification.rb:924:in `each'
    from /usr/lib/ruby/2.1.0/rubygems/specification.rb:924:in `find'
    from /usr/lib/ruby/2.1.0/rubygems/specification.rb:924:in `find_inactive_by_path'
    from /usr/lib/ruby/2.1.0/rubygems.rb:185:in `try_activate'
    from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:132:in `rescue in require'
    from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in `require'
    from /usr/lib/ruby/vendor_ruby/net/http/persistent.rb:12:in `<top (required)>'
    from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/lib/ruby/vendor_ruby/bundler/vendored_persistent.rb:7:in `<top (required)>'
    from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/lib/ruby/vendor_ruby/bundler/fetcher.rb:1:in `<top (required)>'
    from /usr/lib/ruby/vendor_ruby/bundler/cli.rb:239:in `install'
    from /usr/lib/ruby/vendor_ruby/thor/command.rb:27:in `run'
    from /usr/lib/ruby/vendor_ruby/thor/invocation.rb:121:in `invoke_command'
    from /usr/lib/ruby/vendor_ruby/thor.rb:363:in `dispatch'
    from /usr/lib/ruby/vendor_ruby/thor/base.rb:440:in `start'
    from /usr/bin/bundle:20:in `block in <main>'
    from /usr/lib/ruby/vendor_ruby/bundler/friendly_errors.rb:3:in `with_friendly_errors'
    from /usr/bin/bundle:20:in `<main>'

I'm in way over my head. Has anyone any idea what I've done to break it or how I can fix it

Upvotes: 1

Views: 1175

Answers (2)

nikolayp
nikolayp

Reputation: 17949

just remove .bundle directory in your application path

Upvotes: 1

Jared Beck
Jared Beck

Reputation: 17538

As you can see from the stack trace,

/usr/lib/ruby/2.1.0/fileutils.rb:250:in `mkdir': 
  Permission denied @ dir_s_mkdir - 
  /var/lib/gems/2.1.0/extensions/x86-linux/2.1.0/kgio-2.9.2 (Errno::EACCES)
    ...
    from /usr/lib/ruby/2.1.0/fileutils.rb:208:in `mkdir_p'
    ...

bundler is trying to create the directory: /var/lib/gems/2.1.0/extensions/x86-linux/2.1.0/kgio-2.9.2. It is using the equivalent of mkdir -p, which will "create intermediate directories as required." (see man mkdir). So, you need permission to create that directory.

If you're not familiar with unix permissions, you'll have to do some reading, e.g. https://en.wikipedia.org/wiki/File_system_permissions#Traditional_Unix_permissions

Some tools that will be useful include cd, ls -l, chown, and chmod. Don't use them until you've read their manuals, especially chown and chmod.

Upvotes: 2

Related Questions