Bundle install cause strange error - ruby-on-rails

I'm getting a strange error message when running bundle install or even just rails -v within a rails project root directory:
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs': Could not find 'railties' (>= 0) among 16 total gem(s) (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
from /usr/local/bin/rails:22:in `<main>'
However this doesn't happen in my home directory /Users/myname
I messed up something and don't know what, any help?
EDIT
Gemfile
source 'https://rubygems.org'
ruby '2.2.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.0'
gem 'checkr-official'
gem 'chronic'
gem 'devise', '~> 3.4.0'
gem 'exception_notification'
gem 'friendly_id'
gem 'geocoder'
gem 'kaminari'
gem "mini_magick"
gem 'mysql2'
gem 'linkedin'
gem 'omniauth'
gem 'omniauth-facebook'
gem "omniauth-google-oauth2"
gem 'RedCloth'
gem "refile", require: "refile/rails"
gem "refile-mini_magick"
gem 'StreetAddress'
gem "stripe"
gem 'truevault', github: "marks/truevault.rb", ref: "e3bda1af6bfb355"
gem 'whenever', '~> 0.9.4'
gem 'impressionist'
gem "koala"
gem 'twilio-ruby', '~> 4.11.1'
# CSS and javascript
gem 'coffee-rails', '~> 4.1.0'
gem 'compass-rails'
gem 'ejs'
gem 'faker'
gem 'font-awesome-sass', '~> 4.3.0'
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'momentjs-rails', '>= 2.8.1'
gem 'sass-rails'
gem 'uglifier', '>= 1.3.0'
# Generic admin requirements not specified elsewhere
gem 'bootstrap-sass', '>= 3.3' # 3.3 adds better support for media css object
gem 'simple_form', ">= 3.1.0.rc2"
# google api client used for dashboard authorization for google analytics
gem 'google-api-client'
gem 'capistrano', '~> 3.4'
gem 'capistrano-rvm'
gem 'capistrano-rails'
gem "capistrano-db-tasks", require: false
group :development do
gem 'awesome_print', :require => 'ap'
end
group :development, :test do
gem "factory_girl_rails", "~> 4.0"
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
gem 'pry'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', '1.4.0'
end

This error is probably caused by a corruption of the Rails installation.
Try running gem list. If you don't see railties in the list, run gem install rails.
If that doesn't work, I think you should try starting afresh. Create a new gemset, install bundler and run bundle install. That should fix things.

Related

How to completely remove webpack and all its dependencies from Rails App

I created my rails with this template that included webpack, I still write my javascript code in app/assets/javascript. I am trying to deploy my app to heroku and it keeps failing, I get this error
"remote:
/tmp/build_6f0656280cbbda40c5832ccb79fc1783/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/rubygems_integration.rb:432:in
`block in replace_bin_path': can't find executable webpack for gem
webpacker (Gem::Exception)"
I have tried lots of solutions but still cant get my app deployed to Heroku. I want to know how to completely delete webpack and all its depencies from my app since it was not even useful to my app
source 'https://rubygems.org'
ruby '2.3.5'
gem 'figaro'
gem 'jbuilder', '~> 2.0'
gem 'puma'
gem 'rails', '5.1.4'
gem 'redis'
gem 'cloudinary'
gem 'carrierwave', '~> 1.2'
gem 'rails_admin', '~> 1.2'
group :production do
gem 'pg', '~> 0.20'
end
gem 'autoprefixer-rails'
gem 'bootstrap-sass'
gem 'jquery-rails'
gem 'font-awesome-sass'
gem 'sass-rails'
gem 'simple_form'
gem 'turbolinks', '~> 5.0.0'
gem 'coffee-rails'
gem 'uglifier'
gem 'webpacker'
gem 'devise'
gem 'ransack'
gem 'trix'
gem "letter_opener", group: :development
group :development do
gem 'web-console', '>= 3.3.0'
gem 'sqlite3'
end
group :development, :test do
# gem 'binding_of_caller'
# gem 'better_errors'
gem 'pry-byebug'
gem 'pry-rails'
gem 'listen', '~> 3.0.5'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
remove bin/webpackor run bundle exec rake rails:update:bin
remove config/webpacker.yml
remove config/webpack
remove app/javascripts
remove config.webpacker.check_yarn_integrity = false from config/{development, test, production}.rb
verify that you don't have webpacker in your gemfile and run bundle install or bundle clean
imho, don't create your rails app with generators (unless it's your own)

how to fix ruby bundle install error?

Everytime I try to run bundle install inside a local copy of this RoR project directory, I get an error. I have rvm installed with ruby 2.1.2 and 2.2.2, rails is installed as well. I am running via vagrant on this box, Ubuntu 14.04 with 1gb of ram tho I don't think any of this is relevant? I can't seem to find the missing file the error is pointing to as well?
Update: Here is the Gemfile
source 'https://rubygems.org'
ruby '2.2.2'
gem 'rails', '~> 4.1.6'
#gem 'catarse_api', path: '~/code/catarse_api'
gem 'catarse_api', github: 'catarse/catarse_api'
gem 'protected_attributes'
gem 'rails-observers'
gem 'sidekiq', '~> 3.1.3'
# Turns every field on a editable one
gem "best_in_place", :git => "git://github.com/bernat/best_in_place", ref: "ee95961e639022e6aa528704b8cb4789596ea61b"
# State machine for attributes on models
gem 'state_machine', require: 'state_machine/core'
# Database and data related
gem 'pg', '0.17.1'
gem 'dbhero', '>= 1.1.6'
gem 'postgres-copy'
gem 'pg_search'
gem 'i18n_alchemy'
gem 'schema_plus'
gem 'chartkick'
gem 'catarse_settings_db', '>= 0.1.0'
# Notifications
gem 'user_notifier', '~> 0.0.5'
# Mixpanel for backend tracking
gem 'mixpanel-ruby'
gem 'mixpanel_client'
# Payment engines
gem 'catarse_moip', '~> 3.2.0'
gem 'catarse_pagarme', '2.6.8'
#gem 'catarse_pagarme', path: '../catarse_pagarme'
# Decorators
gem 'draper'
# Frontend stuff
gem 'slim-rails'
gem 'jquery-rails'
gem 'browser'
gem "cocoon"
# Static pages
gem 'high_voltage'
# Authentication and Authorization
gem 'omniauth'
gem 'omniauth-twitter'
gem 'omniauth-facebook'
gem 'devise'
gem 'ezcrypto'
gem 'pundit'
# Email marketing
gem 'catarse_monkeymail', '>= 0.1.6'
# HTML manipulation and formatting
gem 'simple_form'
gem 'mail_form'
gem "auto_html"
gem 'kaminari'
gem 'redactor-rails', github: 'catarse/redactor-rails'
# Uploads
gem 'carrierwave', '~> 0.10.0'
gem "mini_magick"
# Other Tools
gem 'to_xls'
gem 'ranked-model'
gem 'feedjira'
gem 'inherited_resources'
gem 'has_scope', '>= 0.6.0.rc'
gem 'spectator-validates_email', require: 'validates_email'
gem 'video_info', '>= 1.1.1'
gem 'httparty', '~> 0.6.1' # this version is required by moip gem, otherwise payment confirmation will break
# Translations
gem 'http_accept_language'
gem 'routing-filter', '~> 0.4.0.pre'
# Payment
gem 'moip', github: 'catarse/moip-ruby', ref: 'c0225ad71645cd1df35dafa1e45c9f092b3abb9e'
gem 'httpclient', '>= 2.2.5'
group :production do
# Gem used to handle image uploading
gem 'fog', '>= 1.3.1'
# Workers, forks and all that jazz
gem 'unicorn'
# Enabling Gzip on Heroku
# If you don't use Heroku, please comment the line below.
gem 'heroku-deflater', '>= 0.4.1'
# Make heroku serve static assets and loggin with stdout
#gem 'rails_on_heroku'
gem 'rails_12factor'
# Monitoring with the new new relic
gem 'newrelic_rpm'
# Using dalli and memcachier have not presented significative performance gains
# Probably this is due to our pattern of cache usage
# + the lack of concurrent procs in our deploy
#gem 'memcachier'
#gem 'dalli'
end
group :development do
gem "letter_opener"
gem 'foreman'
gem 'better_errors'
gem 'binding_of_caller'
gem 'thin'
# Uncomment only for optimization, should be commented on master branch
# gem 'rack-mini-profiler'
# gem 'ruby-prof'
end
group :test, :development do
gem 'rspec-rails', '~> 3.1'
gem 'rspec-mocks'
gem 'rspec-its'
gem 'rspec-collection_matchers'
gem 'pry'
gem 'jasmine-rails'
end
group :test do
gem 'zonebie'
gem 'fakeweb'
gem 'poltergeist'
gem 'launchy'
gem 'database_cleaner'
gem 'shoulda'
gem 'factory_girl_rails'
gem 'capybara', '~> 2.2.0'
gem 'selenium-webdriver'
end
gem 'sass-rails'
gem 'coffee-rails'
gem 'compass-rails'
gem 'uglifier'
gem 'compass-960-plugin'
gem 'sprockets'
# FIXME: Not-anymore-on-development
# Gems that are with 1 or more years on the vacuum
gem 'weekdays'
ps: please point out any relevant info i should provide as well to help determine the cause.
Apparently there was an issue with bundler, here's how this worked out for me:
cleanup by running gem cleanup bundler
reinstall bundler via gem install bundler

Issue deploying RoR app in CF

I am trying to deploy a RoR app using Ruby 2.2.0 and Rails 4.2.0, gem file below. I can run the app locally but when I push to CF I get the following error without any helpful info.
2015-03-03T14:31:26.61-0500 [API] ERR Encountered error: Staging error: failed to stage application:
2015-03-03T14:31:26.61-0500 [API] ERR Script exited with status 255
I am using the CF community ruby buildpack (https://github.com/cloudfoundry/ruby-buildpack.git) since it seems to be the only one support ruby 2.2.
The command I am using to push is cf push myapp -b https://github.com/cloudfoundry/ruby-buildpack.git
Gemfile:
source 'https://rubygems.org'
ruby "2.2.0"
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
# https://github.com/namick/obfuscate_id
gem 'obfuscate_id', github: 'namick/obfuscate_id'
gem 'yui-compressor'
# https://github.com/attr-encrypted/attr_encrypted
gem 'attr_encrypted'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
group :development, :test do
gem 'rspec-rails', '~> 3.0'
gem 'factory_girl_rails', "~> 4.0"
gem 'capybara'
gem 'capybara-email' #, github: 'dockyard/capybara-email'
gem 'guard-rspec'
gem 'guard-livereload'
gem 'guard-resque', github: 'railsjedi/guard-resque'
gem 'launchy'
gem 'faker'
gem 'pry-byebug'
gem 'pry-macro'
gem 'seed_dumper'
gem 'ruby-prof'
# Enough of these assets messages in log!
gem 'disable_assets_logger'
gem 'railroady'
end
# Testing
group :test do
gem 'simplecov', require: false
gem 'rubocop', require: false
gem 'rubocop-rspec', require: false
gem "database_cleaner"
gem 'timecop'
gem 'poltergeist'
gem "fakeredis", :require => "fakeredis/rspec"
end
group :development do
# gem 'binding_of_caller', '>= 0.7.1'
# gem 'better_errors', '>= 0.7.2'
gem 'web-console', '~> 2.0'
gem 'binding_of_caller', '0.7.3.pre1'
gem 'capistrano'
gem 'capistrano-rvm'
gem 'capistrano-rails'
gem 'capistrano-resque', '~> 0.2.1', require: false
gem 'spring-commands-rspec'
gem 'awesome_print'
gem 'pry-rails'
gem 'meta_request'
gem 'bullet'
end
# Database
gem 'pg'
gem 'sqlite3'
gem 'cf-autoconfig'
gem 'groupdate'
gem 'redis-rails'
gem 'apartment', github: 'influitive/apartment'
# Service object pattern
gem 'interactor-rails', '~> 2.0'
# Currency
gem 'money-rails'
gem 'google_currency'
# Analytics
gem 'ga_events'
gem 'newrelic_rpm'
# Twitter Bootstrap
gem 'sass-rails', '4.0.3'
gem 'bootstrap-sass', '~> 3.3.1'
gem 'bootstrap-sass-extras'
gem 'autoprefixer-rails'
gem 'momentjs-rails', '>= 2.8.1'
gem 'bootstrap3-datetimepicker-rails', '~> 3.1.3'
# Design stuff
#gem 'table_for_collection'
gem 'simple_form', github: 'plataformatec/simple_form'
gem "font-awesome-rails"
# Static pages (without dealing with too many routes)
gem 'high_voltage'
gem 'nestive', '~> 0.5'
# Social Network Sharing
# gem 'shareable'
# Front-end
gem 'haml-rails'
gem 'draper', '~> 1.4'
gem 'humane-rails'
gem 'autonumeric-rails'
gem 'country_select'
# A/B Testing gem (remove for optimizely?)
gem 'split', require: 'split/dashboard'
# Structure js files and view integration
gem 'pluggable_js', '~> 2.0.0'
# Sign up wizard
gem 'wicked'
# Graphs
gem 'lazy_high_charts'
#Account management
gem 'devise'
gem 'devise_invitable'
gem 'omniauth'
gem 'omniauth-xero', github: 'kaleworsley/omniauth-xero'
gem 'omniauth-freshbooks'
gem 'omniauth-quickbooks'
#gem 'omniauth-linkedin'
#gem 'omniauth-twitter'
#gem 'omniauth-facebook'
#gem 'omniauth-yelp'
gem 'pundit'
# Audit
gem 'paper_trail', '~> 3.0.5'
gem 'activeadmin', github: 'activeadmin'
gem 'enumerize'
gem 'enum_help'
# External accounts
#gem 'xeroizer', '2.15.5'
gem 'freshbooks.rb'
gem 'quickbooks-ruby'
#https://github.com/cloocher/aggcat
#gem 'aggcat'
# MailChimp integration
gem 'gibbon'
# Contact us, https://github.com/plataformatec/mail_form
gem 'mail_form'
# Page caching
gem 'actionpack-page_caching'
# Other helpers
gem "workflow"
#gem "httparty"
gem "resque", "~> 1.25.2"
gem 'resque-status'
I actually ended up pulling a clean copy from git of my app and used the (https://github.com/cloudfoundry/ruby-buildpack.git buildpack and everything magically worked. I think Cloud Foundry was trying to use an old version of a buildpack somehow...

All Heroku Commands Are Broken due to Ruby Version

Everytime I run a heroku command I receive this error:
Your Ruby version is 1.9.3, but your Gemfile specified 2.1.2
This has been happening since I pushed several changes (adding sidekiq and making changes to my clock.rb file, also: a new model I need to migrate the db for)
Does anyone know why this might be happening? It only started after I added ruby '2.1.2' to the gemfile. But before that I was getting this funky segmentation fault error.
Here's my gemfile:
source 'https://rubygems.org'
ruby '2.1.2'
gem 'rails', '4.1.1'
gem 'pg'
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'clockwork'
gem 'httparty'
gem 'omniauth-facebook'
gem 'parse-ruby-client'
gem 'parse_resource', '~> 1.8.0'
gem 'stripe', :git => 'https://github.com/stripe/stripe-ruby'
gem 'sidekiq'
gem 'foundation-rails'
group :development, :test do
gem 'pry-rails'
gem 'rspec-rails'
gem 'factory_girl_rails'
gem 'shoulda-matchers'
gem 'valid_attribute'
gem 'capybara'
gem 'dotenv-rails'
gem 'better_errors'
gem 'binding_of_caller'
end
group :production do
gem 'rails_12factor'
gem 'thin'
end
It's seems to related bundler issue. Go through here https://github.com/sstephenson/rbenv/issues/400 same sort of issue also here get fixed with :
# Rakefile
task :freedom do
Bundler.with_clean_env { sh "heroku" }
end
Hope this help you!
I had two applications using Ruby. In your terminal, change to the directory of the application, then check the Ruby version you are using. Update it appropriately.

Why am I getting this simple error when using `acts_as_taggable_on`?

I wanted to set up ActsAsTaggableOn.strict_case_match = true
According to http://5minutenpause.com/blog/2012/11/20/careful-where-you-get-your-gems-from/, it seems I have to download the gem from github. So I made it that way and tried to run App.
However, it returns this error:(
Error message: (I've tried bundle install but still the same error message!)
git://github.com/mbleigh/acts-as-taggable-on.git (at master) is not checked out. Please run `bundle install` (Bundler::GitError)
Exception class:
PhusionPassenger::UnknownError
Here are my codes!
config/initializer/tag_list.rb
ActsAsTaggableOn.delimiter = ','
ActsAsTaggableOn.remove_unused_tags = true
ActsAsTaggableOn.strict_case_match = true
Gemfile
gem 'acts-as-taggable-on', git: 'git://github.com/mbleigh/acts-as-taggable-on.git'
I made a try to change the source to download the gem directly from to rubyorg, not from the Github. It's just like this.
gem 'acts-as-taggable-on', '2.3.3'
Now it returns this error:(
Error message:
undefined method `strict_case_match=' for ActsAsTaggableOn:Module
How can I solve this?
UPDATE:
Gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.11'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql2'
gem 'execjs'
gem 'therubyracer'
gem 'devise', '2.0.1'
gem 'recaptcha', :require => 'recaptcha/rails'
gem 'paperclip', "~> 3.0"
gem "cocaine"
gem 'mailboxer', '0.7.0'
gem 'sunspot_rails'
gem 'sunspot_solr'
group :development do
gem 'better_errors'
gem 'binding_of_caller'
#gem 'rack-mini-profiler'
end
gem 'progress_bar'
gem 'kaminari', '0.14.0'
gem "sunspot_with_kaminari", '~> 0.1'
gem 'i18n_generators'
gem 'ancestry'
gem 'acts-as-taggable-on', '2.3.3'
gem 'acts_as_commentable_with_threading'
gem 'twitter-bootstrap-rails'
gem "less-rails"
gem 'crummy', '~> 1.6.0'
gem 'rails3_acts_as_paranoid'
gem 'galetahub-simple_captcha', :require => 'simple_captcha'
gem "acts_as_follower"
gem "jpmobile"
gem "rqrcode-rails3"
gem 'acts_as_votable', '~> 0.4.0'
gem 'rails3-jquery-autocomplete'
gem "cancan"
gem 'rinku', '1.5.1'
gem 'dalli'
gem "auto_html", '1.6.0'
gem "rails_autolink"
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
gem 'jquery-ui-rails'
end
gem 'jquery-rails'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'debugger'
The problem is that the version 2.3.3 from acts-as-taggable-on was released 9 months ago and doesn't include the strict_case_match feature.
Your Gemfile has too look this this:
gem 'acts-as-taggable-on', git: 'git://github.com/mbleigh/acts-as-taggable-on.git'
the same way you had, and run:
bundle update acts-as-taggable-on
if that doesn't work, just delete your Gemfile.lock and run bundle install and bundle update
notice that its a development version of the gem, not ready for production, but you can take the risk and be a an alpha user of the gem and report any issue you find :)

Resources