bundle -v
/Users/Aals/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'bundler' (>= 0) among 39 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/Users/Aals/.gem/ruby/2.2.0:/Users/Aals/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0', execute `gem env` for more information
from /Users/Aals/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/dependency.rb:324:in `to_spec'
from /Users/Aals/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:64:in `gem'
from /Users/Aals/.rbenv/versions/2.2.3/bin/bundle:22:in `<main>'
type bundle
bundle is hashed (/Users/Aals/.rbenv/shims/bundle)
type -a bundle
bundle is hashed (/Users/Aals/.rbenv/shims/bundle)
gem install bundler
ERROR: While executing gem ... (Errno::EACCES)
Permission denied @ rb_sysopen - /Users/Aals/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/.gitignore
gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.8
- RUBY VERSION: 2.2.3 (2015-08-18 patchlevel 173) [x86_64-darwin15]
- INSTALLATION DIRECTORY: /Users/Aals/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0
- RUBY EXECUTABLE: /Users/Aals/.rbenv/versions/2.2.3/bin/ruby
- EXECUTABLE DIRECTORY: /Users/Aals/.rbenv/versions/2.2.3/bin
- SPEC CACHE DIRECTORY: /Users/Aals/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/Aals/.rbenv/versions/2.2.3/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-15
- GEM PATHS:
- /Users/Aals/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0
- /Users/Aals/.gem/ruby/2.2.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/Aals/.rbenv/versions/2.2.3/bin
- /usr/local/Cellar/rbenv/0.4.0/libexec
- /usr/local/bin
- /usr/local/sbin
- /usr/local/mysql/bin
- /Users/Aals/.rbenv/shims
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
gem uninstall bundler && gem install bundler
ERROR: While executing gem ... (Errno::EACCES)
Permission denied @ rb_sysopen - /Users/Aals/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/.gitignore
I thought i solved it by doing this,
export GEM_HOME=$PWD/vendor/bundle/ruby/2.2.3
gem uninstall bundler
gem install bundler
But i could not solve it, after running command "bundle install" in the rails project directory throws the same error
/Users/Aals/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'bundler' (>= 0) among 39 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/Users/Aals/.gem/ruby/2.2.0:/Users/Aals/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0', execute `gem env` for more information
from /Users/Aals/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/dependency.rb:324:in `to_spec'
from /Users/Aals/.rbenv/versions/2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:64:in `gem'
from /Users/Aals/.rbenv/versions/2.2.3/bin/bundle:22:in `<main>'
alvin:simple_cms Aals$ gem uninstall bundler
I am very new to Ruby, Please help me to solve this.
Hi, sorry that you had trouble. I think that your main problem is that you tried to install some Ruby versions using sudo, and now you don't have permission to install gems in that versions as a regular user.
To fix, you don't have to explicitly set GEM_HOME to anything. Please unset that if you have set GEM_HOME anywhere.
Instead, you should just change the permissions to your own user:
sudo chown -R "${USER}:staff" ~/.rbenv
and then:
gem uninstall bundler
gem install bundler
Thanks a lot. Please take a look at this. Could you please tell me why i could not start rails server ???
Last login: Wed Nov 4 02:35:52 on ttys000
alvin:~ Aals$ sudo chown -R "${USER}:staff" ~/.rbenv
Password:
alvin:~ Aals$ gem uninstall bundler
alvin:~ Aals$ gem install bundler
Successfully installed bundler-1.10.6
Parsing documentation for bundler-1.10.6
Done installing documentation for bundler after 6 seconds
1 gem installed
alvin:~ Aals$ cd /Users/Aals/Desktop/Dummy/
alvin:Dummy Aals$ rails new dummy_CMS -d mysql
create
create README.rdoc
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/assets/javascripts/application.js
create app/assets/stylesheets/application.css
create app/controllers/application_controller.rb
create app/helpers/application_helper.rb
create app/views/layouts/application.html.erb
create app/assets/images/.keep
create app/mailers/.keep
create app/models/.keep
create app/controllers/concerns/.keep
create app/models/concerns/.keep
create bin
create bin/bundle
create bin/rails
create bin/rake
create bin/setup
create config
create config/routes.rb
create config/application.rb
create config/environment.rb
create config/secrets.yml
create config/environments
create config/environments/development.rb
create config/environments/production.rb
create config/environments/test.rb
create config/initializers
create config/initializers/assets.rb
create config/initializers/backtrace_silencers.rb
create config/initializers/cookies_serializer.rb
create config/initializers/filter_parameter_logging.rb
create config/initializers/inflections.rb
create config/initializers/mime_types.rb
create config/initializers/session_store.rb
create config/initializers/wrap_parameters.rb
create config/locales
create config/locales/en.yml
create config/boot.rb
create config/database.yml
create db
create db/seeds.rb
create lib
create lib/tasks
create lib/tasks/.keep
create lib/assets
create lib/assets/.keep
create log
create log/.keep
create public
create public/404.html
create public/422.html
create public/500.html
create public/favicon.ico
create public/robots.txt
create test/fixtures
create test/fixtures/.keep
create test/controllers
create test/controllers/.keep
create test/mailers
create test/mailers/.keep
create test/models
create test/models/.keep
create test/helpers
create test/helpers/.keep
create test/integration
create test/integration/.keep
create test/test_helper.rb
create tmp/cache
create tmp/cache/assets
create vendor/assets/javascripts
create vendor/assets/javascripts/.keep
create vendor/assets/stylesheets
create vendor/assets/stylesheets/.keep
run bundle install
bundle install
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.4.2
Using i18n 0.7.0
Installing json 1.8.3 with native extensions
Installing minitest 5.8.2
Using thread_safe 0.3.5
Using tzinfo 1.2.2
Using activesupport 4.2.4
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile 0.6.2
Using nokogiri 1.6.6.2
Using rails-deprecated_sanitizer 1.0.3
Using rails-dom-testing 1.0.7
Using loofah 2.0.3
Using rails-html-sanitizer 1.0.2
Using actionview 4.2.4
Using rack 1.6.4
Using rack-test 0.6.3
Using actionpack 4.2.4
Using globalid 0.3.6
Using activejob 4.2.4
Using mime-types 2.6.2
Using mail 2.6.3
Using actionmailer 4.2.4
Using activemodel 4.2.4
Using arel 6.0.3
Using activerecord 4.2.4
Installing debug_inspector 0.0.2 with native extensions
Installing binding_of_caller 0.7.2 with native extensions
Using bundler 1.10.6
Installing byebug 6.0.2 with native extensions
Installing coffee-script-source 1.9.1.1
Installing execjs 2.6.0
Installing coffee-script 2.4.1
Using thor 0.19.1
Using railties 4.2.4
Installing coffee-rails 4.1.0
Installing multi_json 1.11.2
Installing jbuilder 2.3.2
Installing jquery-rails 4.0.5
Installing mysql2 0.4.1 with native extensions
Using sprockets 3.4.0
Using sprockets-rails 2.3.3
Using rails 4.2.4
Using rdoc 4.2.0
Installing sass 3.4.19
Installing tilt 2.0.1
Installing sass-rails 5.0.4
Installing sdoc 0.4.1
Installing spring 1.4.0
Installing turbolinks 2.5.3
Installing uglifier 2.7.2
Installing web-console 2.2.1
Bundle complete! 12 Gemfile dependencies, 53 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
run bundle exec spring binstub --all
* bin/rake: spring inserted
* bin/rails: spring inserted
And also i could not start rails server, Please see this.
alvin:Dummy Aals$ rails s
Usage:
rails new APP_PATH [options]
Options:
-r, [--ruby=PATH] # Path to the Ruby binary of your choice
# Default: /Users/Aals/.rbenv/versions/2.2.3/bin/ruby
-m, [--template=TEMPLATE] # Path to some application template (can be a filesystem path or URL)
[--skip-gemfile], [--no-skip-gemfile] # Don't create a Gemfile
-B, [--skip-bundle], [--no-skip-bundle] # Don't run bundle install
-G, [--skip-git], [--no-skip-git] # Skip .gitignore file
[--skip-keeps], [--no-skip-keeps] # Skip source control .keep files
-O, [--skip-active-record], [--no-skip-active-record] # Skip Active Record files
-S, [--skip-sprockets], [--no-skip-sprockets] # Skip Sprockets files
[--skip-spring], [--no-skip-spring] # Don't install Spring application preloader
-d, [--database=DATABASE] # Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite3/frontbase/ibm_db/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)
# Default: sqlite3
-j, [--javascript=JAVASCRIPT] # Preconfigure for selected JavaScript library
# Default: jquery
-J, [--skip-javascript], [--no-skip-javascript] # Skip JavaScript files
[--dev], [--no-dev] # Setup the application with Gemfile pointing to your Rails checkout
[--edge], [--no-edge] # Setup the application with Gemfile pointing to Rails repository
[--skip-turbolinks], [--no-skip-turbolinks] # Skip turbolinks gem
-T, [--skip-test-unit], [--no-skip-test-unit] # Skip Test::Unit files
[--rc=RC] # Path to file containing extra configuration options for rails command
[--no-rc], [--no-no-rc] # Skip loading of extra configuration options from .railsrc file
Runtime options:
-f, [--force] # Overwrite files that already exist
-p, [--pretend], [--no-pretend] # Run but do not make any changes
-q, [--quiet], [--no-quiet] # Suppress status output
-s, [--skip], [--no-skip] # Skip files that already exist
Rails options:
-h, [--help], [--no-help] # Show this help message and quit
-v, [--version], [--no-version] # Show Rails version number and quit
Description:
The 'rails new' command creates a new Rails application with a default
directory structure and configuration at the path you specify.
You can specify extra command-line arguments to be used every time
'rails new' runs in the .railsrc configuration file in your home directory.
Note that the arguments specified in the .railsrc file don't affect the
defaults values shown above in this help message.
Example:
rails new ~/Code/Ruby/weblog
This generates a skeletal Rails installation in ~/Code/Ruby/weblog.
See the README in the newly created application to get going.
After this when do bundle install , this happens
alvin:Dummy Aals$ bundle install
Could not locate Gemfile or .bundle/ directory
alvin:Dummy Aals$
I solved it by doing this -->> If you can explain to me, why this is happened, that would be really great.
alvin:Dummy Aals$ rails new .
exist
create README.rdoc
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/assets/javascripts/application.js
create app/assets/stylesheets/application.css
create app/controllers/application_controller.rb
create app/helpers/application_helper.rb
create app/views/layouts/application.html.erb
create app/assets/images/.keep
create app/mailers/.keep
create app/models/.keep
create app/controllers/concerns/.keep
create app/models/concerns/.keep
create bin
create bin/bundle
create bin/rails
create bin/rake
create bin/setup
create config
create config/routes.rb
create config/application.rb
create config/environment.rb
create config/secrets.yml
create config/environments
create config/environments/development.rb
create config/environments/production.rb
create config/environments/test.rb
create config/initializers
create config/initializers/assets.rb
create config/initializers/backtrace_silencers.rb
create config/initializers/cookies_serializer.rb
create config/initializers/filter_parameter_logging.rb
create config/initializers/inflections.rb
create config/initializers/mime_types.rb
create config/initializers/session_store.rb
create config/initializers/wrap_parameters.rb
create config/locales
create config/locales/en.yml
create config/boot.rb
create config/database.yml
create db
create db/seeds.rb
create lib
create lib/tasks
create lib/tasks/.keep
create lib/assets
create lib/assets/.keep
create log
create log/.keep
create public
create public/404.html
create public/422.html
create public/500.html
create public/favicon.ico
create public/robots.txt
create test/fixtures
create test/fixtures/.keep
create test/controllers
create test/controllers/.keep
create test/mailers
create test/mailers/.keep
create test/models
create test/models/.keep
create test/helpers
create test/helpers/.keep
create test/integration
create test/integration/.keep
create test/test_helper.rb
create tmp/cache
create tmp/cache/assets
create vendor/assets/javascripts
create vendor/assets/javascripts/.keep
create vendor/assets/stylesheets
create vendor/assets/stylesheets/.keep
run bundle install
bundle install
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.4.2
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.8.2
Using thread_safe 0.3.5
Using tzinfo 1.2.2
Using activesupport 4.2.4
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile 0.6.2
Using nokogiri 1.6.6.2
Using rails-deprecated_sanitizer 1.0.3
Using rails-dom-testing 1.0.7
Using loofah 2.0.3
Using rails-html-sanitizer 1.0.2
Using actionview 4.2.4
Using rack 1.6.4
Using rack-test 0.6.3
Using actionpack 4.2.4
Using globalid 0.3.6
Using activejob 4.2.4
Using mime-types 2.6.2
Using mail 2.6.3
Using actionmailer 4.2.4
Using activemodel 4.2.4
Using arel 6.0.3
Using activerecord 4.2.4
Using debug_inspector 0.0.2
Using binding_of_caller 0.7.2
Using bundler 1.10.6
Using byebug 6.0.2
Using coffee-script-source 1.9.1.1
Using execjs 2.6.0
Using coffee-script 2.4.1
Using thor 0.19.1
Using railties 4.2.4
Using coffee-rails 4.1.0
Using multi_json 1.11.2
Using jbuilder 2.3.2
Using jquery-rails 4.0.5
Using sprockets 3.4.0
Using sprockets-rails 2.3.3
Using rails 4.2.4
Using rdoc 4.2.0
Using sass 3.4.19
Using tilt 2.0.1
Using sass-rails 5.0.4
Using sdoc 0.4.1
Using spring 1.4.0
Installing sqlite3 1.3.11 with native extensions
Using turbolinks 2.5.3
Using uglifier 2.7.2
Using web-console 2.2.1
Bundle complete! 12 Gemfile dependencies, 53 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
run bundle exec spring binstub --all
* bin/rake: spring inserted
* bin/rails: spring inserted
alvin:Dummy Aals$
alvin:Dummy Aals$ bundle install
Using rake 10.4.2
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.8.2
Using thread_safe 0.3.5
Using tzinfo 1.2.2
Using activesupport 4.2.4
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile 0.6.2
Using nokogiri 1.6.6.2
Using rails-deprecated_sanitizer 1.0.3
Using rails-dom-testing 1.0.7
Using loofah 2.0.3
Using rails-html-sanitizer 1.0.2
Using actionview 4.2.4
Using rack 1.6.4
Using rack-test 0.6.3
Using actionpack 4.2.4
Using globalid 0.3.6
Using activejob 4.2.4
Using mime-types 2.6.2
Using mail 2.6.3
Using actionmailer 4.2.4
Using activemodel 4.2.4
Using arel 6.0.3
Using activerecord 4.2.4
Using debug_inspector 0.0.2
Using binding_of_caller 0.7.2
Using byebug 6.0.2
Using coffee-script-source 1.9.1.1
Using execjs 2.6.0
Using coffee-script 2.4.1
Using thor 0.19.1
Using railties 4.2.4
Using coffee-rails 4.1.0
Using multi_json 1.11.2
Using jbuilder 2.3.2
Using jquery-rails 4.0.5
Using bundler 1.10.6
Using sprockets 3.4.0
Using sprockets-rails 2.3.3
Using rails 4.2.4
Using rdoc 4.2.0
Using sass 3.4.19
Using tilt 2.0.1
Using sass-rails 5.0.4
Using sdoc 0.4.1
Using spring 1.4.0
Using sqlite3 1.3.11
Using turbolinks 2.5.3
Using uglifier 2.7.2
Using web-console 2.2.1
Bundle complete! 12 Gemfile dependencies, 53 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
alvin:Dummy Aals$ rails s
=> Booting WEBrick
=> Rails 4.2.4 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2015-11-04 19:39:19] INFO WEBrick 1.3.1
[2015-11-04 19:39:19] INFO ruby 2.2.3 (2015-08-18) [x86_64-darwin15]
[2015-11-04 19:39:19] INFO WEBrick::HTTPServer#start: pid=95118 port=3000
Started GET "/" for ::1 at 2015-11-04 19:39:30 +0530
Processing by Rails::WelcomeController#index as HTML
Rendered /Users/Aals/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/railties-4.2.4/lib/rails/templates/rails/welcome/index.html.erb (3.1ms)
Completed 200 OK in 84ms (Views: 51.1ms | ActiveRecord: 0.0ms)
When you first did rails new dummy_CMS -d mysql, you forgot to cd into the new directory dummy_CMS where the app was generated. That's why rails s and bundle install didn't work— you were not in the project's directory.
Also, when in the project's directory, it's smart to invoke bin/rails instead of just rails. This is because bin/rails is tailored for the current app.
Most helpful comment
Hi, sorry that you had trouble. I think that your main problem is that you tried to install some Ruby versions using
sudo, and now you don't have permission to install gems in that versions as a regular user.To fix, you don't have to explicitly set
GEM_HOMEto anything. Please unset that if you have set GEM_HOME anywhere.Instead, you should just change the permissions to your own user:
and then: