bundle install gemspec error spree_social.gemspec - ruby-on-rails

In my app when I am running bundle install, I am getting below error.
vendor/gems/spree_social/spree_social.gemspec
is not valid. Please fix this gemspec.
The validation error was 'spree_social-3.1.0.beta contains itself
(spree_social-3.1.0.beta.gem), check your files list'
I tried everything like removing the Gemlock and updating the gems. It didn't work.
Below is my Gemfile
source 'https://rubygems.org'
ruby '2.3.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5'
# Use sqlite3 as the database for Active Record
gem 'font-awesome-sass', '~> 4.5.0'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
gem 'roo-xls'
# 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', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'aws-sdk', '< 2.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
gem 'paperclip'
# Use Unicorn as the app server
# gem 'unicorn'
gem 'rails_12factor', group: :production
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
gem 'sqlite3'
end
group :production do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'pg'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
gem 'spree_scaffold', github: 'freego/spree_scaffold'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
end
gem 'spree', '3.0.5'
gem 'spree_gateway', github: 'spree/spree_gateway', branch: '3-0-stable'
gem 'spree_wishlist' , :path => File.join(File.dirname(__FILE__), '/vendor/gems/spree_wishlist-2.2.0')
gem 'spree_social', :path => File.join(File.dirname(__FILE__), '/vendor/gems/spree_social')
gem 'spree_gift_card', :path => File.join(File.dirname(__FILE__), '/vendor/gems/spree_gift_card')
gem 'stringex'
gem 'spree_reviews', :path => File.join(File.dirname(__FILE__), '/vendor/gems/spree_reviews')
gem 'spree_auth_devise', :path => File.join(File.dirname(__FILE__), '/vendor/gems/spree_auth_devise-3.0.6')
gem 'spree_mail_settings', :path => File.join(File.dirname(__FILE__), '/vendor/gems/spree_mail_settings')
gem 'spree_mail_settings', github: 'spree-contrib/spree_mail_settings', branch: 'master'
Anyone else faced this?
Thanks

This is most likely because your compiled .gem file is contained in the repository. I assume that this is because the gem is trying to package the spree_social-3.1.0.beta.gem file inside itself, and it doesn't like that. Try removing the .gem file from the repository and rerunning bundle install.
I am willing to bet that File.join(File.dirname(__FILE__), '/vendor/gems/spree_social' points to a git repository, where bundle install will compile and install the gem each time you try to run it. My understanding is that when the gem is compiled in this way, it runs git ls-files -z`.split("\x0") on the git repository to get the list of files to put in the gem. Since the .gem file appears in the results, it tries to compile it into the gem, which causes it to fail.
I ran into this issue today, where my Gemfile was pulling a gem from a repository I published to Github, and bundle install kept failing until I removed the .gem file from the repository.

Related

Rails 'bundle install' fails because attempt to write to file 'is unsupported by your OS'

I'm attempting to run a rails app on my local machine developed elsewhere, but I can't get it to run locally. When I run rails s to get the server running, I get:
Could not find proper version of railties (4.2.6) in any of the sources
Run `bundle install` to install missing gems.
So, naturally, I run bundle install but get the error:
Attempting to write to
`/home/rails/apps/intranet/shared/bundle/ruby/2.2.0` is
unsupported by your OS
My OS is macOS Sierra version 10.12.4.
Also, railties is in the gem folder and seems to be the correct version.
Thanks in advance.
Edit: Adding Gemfile
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.6'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/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', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
gem 'devise'
gem 'rails_admin'
gem 'carrierwave'
gem 'where-or'
# Railties
gem 'railties', '~> 4.2', '>= 4.2.6'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
gem 'rspec-rails'
gem 'factory_girl_rails'
gem 'pry-rails'
end
group :development do
# 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'
gem 'guard', require: false
gem 'guard-rspec', require: false
gem 'guard-bundler', require: false
gem "guard-cucumber", require: false
gem 'ruby_gntp'
gem 'terminal-notifier'
gem 'terminal-notifier-guard'
gem 'thin'
gem 'quiet_assets'
gem 'capistrano-rails'
gem 'capistrano-rvm'
gem 'capistrano3-unicorn'
gem 'capistrano-bundler'
gem 'better_errors'
gem 'binding_of_caller'
end
group :test do
gem 'database_cleaner'
gem 'capybara'
gem 'shoulda-matchers'
gem 'poltergeist'
gem 'launchy'
gem "cucumber-rails", require: false
end
Found out what was the issue. Since this was downloaded from a remote server, the .bundle/config file had a different path for 'BUNDLE_PATH'. I simply had to change that to the path on my own computer instead of the path on the remote server and I stopped getting the error.
check if you have write permissions to the directory /home/rails/apps/intranet/shared/bundle/ruby/2.2.0`

Spree Rails app startup error 'Instance method "open" is already defined in Object'

This error happens when trying to run my Rails app in the production environment, but not dev:
Instance method "open" is already defined in Object, use generic helper instead or set StateMachines::Machine.ignore_method_conflicts = true.
I'm relatively new to Rails and could use some help figuring out how to troubleshoot this. What might be causing the error? Where should I look, or what steps should I try in order to narrow down what's happening?
I recently upgraded from Ruby 2.2.2 to 2.2.4, but this error didn't appear immediately. Other recently changes to the app have been confined to js, css, and ERB view files.
My Gemfile:
source 'https://rubygems.org'
ruby '2.2.4'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.3' #TODO settle on a non-edge Rails once enum prefixing is released
#gem 'rails', github: 'rails/rails'
# Use sqlite3 as the database for Active Record
#gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# 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', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
end
gem 'rails_12factor', group: :production
# group :development do
# gem 'rails-dev-boost', :git => 'git://github.com/thedarkone/rails-dev-boost.git' #speed up development
# gem 'rb-inotify', '>= 0.8.8'
# end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
#gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'spree', branch: '3-0-stable'
gem 'spree_gateway', github: 'spree/spree_gateway', branch: '3-0-stable'
gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '3-0-stable'
gem 'pg'
gem 'spree_i18n', git: 'git://github.com/spree/spree_i18n.git', branch: '3-0-stable'
gem 'spree_yadav_jewelry', :path => 'extensions/spree_yadav_jewelry'
gem 'spree_yadav_diamonds', :path => 'extensions/spree_yadav_diamonds'
gem 'has_scope'
gem 'aws-sdk-v1'
gem 'spree_static_content', github: 'spree-contrib/spree_static_content', branch: '3-0-stable'
gem 'spree_contact_us', github: 'spree-contrib/spree_contact_us', branch: '3-0-stable'
gem 'font-awesome-sass'
This is only a warning message caused by state-machines gem.
This will be fixed in Spree 3.0.8. Sorry for the inconvenience!

Rake Assets Precompile without Gems in Development or Test Groups

Okay, so I've got an error while building my Docker image (think of it as similar to a deploy step, or Heroku deploy if you're unfamiliar with Docker).
Gems that are in the :test and :development groups are being looked for when the precompile step happens, and since I've bundled --without development test - as I don't want to have QT just so that capybara-webkit doesn't error on bundle - the precompile step is throwing an error.
The error is always a variant of:
Could not find <gem-name> in any of the sources (Bundler::GemNotFound)
My Gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.9'
# Use sqlite3 as the database for Active Record
# gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# 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', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
gem 'unicorn', '~> 4.8.3'
gem 'unicorn-worker-killer', '~> 0.4.2'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
gem 'rdf', '~> 1.1.0'
gem 'tripod', '~> 0.11.1'
gem 'devise'
gem 'devise_invitable'
gem 'authority'
gem 'mongoid', '~> 4.0.0'
gem 'bootstrap-sass', '~> 3.3.3'
# pagination
gem 'kaminari', '~> 0.16.3'
gem 'bootstrap-kaminari-views'
# background processing
gem 'sidekiq'
gem 'sidekiq-status'
gem 'request_store', '~> 1.1.0'
# add memoization
gem 'memoist', '~> 0.12.0'
# dropbox gem for uploads etc
gem 'dropbox-sdk', '~> 1.6.4'
# error reporting
gem 'sentry-raven'
group :development, :test do
gem "rspec-rails", "~> 3.0.0"
gem "factory_girl_rails", "~> 4.5.0"
gem "capybara", "~> 2.4"
gem "database_cleaner"
# gem "selenium-webdriver"
gem 'poltergeist'
gem 'capybara-webkit'
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
#gem 'byebug'
gem 'pry-byebug'
gem 'better_errors', '~> 2.1.1'
# 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'
end
The line in the Dockerfile where the error happens is:
RUN /bin/bash -l -c "RAILS_ENV=production bundle exec rake assets:precompile RAILS_GROUPS=assets --trace"
So basically, what I'm really after is the equivalent for --without test development for the rake task. Can I do that? As per some advice, I've already changed (in application.rb):
Bundler.require(*Rails.groups)
to
Bundler.require(:default, :assets, Rails.env)
Anybody have Rails-fu enough to solve this one? I've looked in the docs and on SO, as well as asking my colleagues but I'm still banging my head against the wall over this.
bundle install --path vendor/cache
Try this and let me know if it doesn't work!

Heroku states "Specified 'sqlite3' for database adapter"

Heroku states "Specified 'sqlite3' for database adapter, but the gem is not loaded. Add gem 'sqlite3' to your Gemfile" on the inital commit.
I've already changed my Gemfile so that sqlite is used in development and pg is used in production mode. My database.yml is added to the .gitignore file. Are there any places where I have to change sqlite to pg?
Thanks in advance
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.1'
gem 'activeadmin', github: 'gregbell/active_admin'
gem 'anjlab-bootstrap-rails', :require => 'bootstrap-rails',
:github => 'anjlab/bootstrap-rails',
:branch => '3.0.0'
gem "font-awesome-rails"
gem "json"
gem "nokogiri"
gem "leaflet-rails"
gem "mapbox-rails"
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# 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'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
group :production, :staging do
gem 'pg'
gem 'rails_12factor'
end
group :development do
gem 'sqlite3'
gem 'better_errors'
gem "binding_of_caller"
end
# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.1.2'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
I previously ran
bundle install --without production
the solution to my problem was to install also the production gems. What my production gems have to do with a "specified sqlite3 adapter" I don't understand at all.

Could not find generator 'devise:install' unless using sudo rails generate devise:install

I have a rails app that I am trying to install devise on.
I use the command
rails generate devise:install
but it fails, giving this message:
Could not find generator 'devise:install'. Maybe you meant 'ckeditor:install', 'assets' or 'comment'
however if I use sudo rails generate devise:install it works.
I do not want to generate devise:install as root however.
I have done chmod a+x on the directory.
I also recently changed macbooks and imported my ssh key from the previous macbook, but I added the key with ssh-add. Not sure if this is the problem.
this is my gemfile:
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.3'
gem 'thin'
# Use sqlite3 as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
gem 'devise', '3.5.3'
gem 'bootstrap-sass', '~> 3.2.0'
gem 'autoprefixer-rails'
gem 'bootstrap_form'
gem 'kaminari'
gem 'carrierwave'
gem "rmagick", :require => 'RMagick'
gem 'ckeditor'
gem 'acts_as_commentable'
gem 'addressable'
gem 'vimeo'
gem 'underscore-rails'
gem 'gmaps4rails'
gem 'geocoder'
# 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', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# 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'
end
gem 'rails_12factor', group: :production
I managed to solve this by deleting my Gemfile.lock, doing bundle install again and then stopping spring with spring stop I could then call the generator without root privileges
It's kind of weird, but I solve the problem restarting my mac

Resources