I've read an amazing solution to solve therubyracer on windows problem: therubyracer gem on windows, but I don't exactly know how to remove the dependency of therubyracer from less-rails gem. After I bundle install a gemfile without therubyracer, it still display an error
[WARNING] Please install gem 'therubyracer' to use Less...
This is what I wrote for my gemfile:
source 'https://rubygems.org'
ruby '2.0.0'
gem 'rails'
gem 'execjs'
group :development do
gem 'sqlite3'
end
group :production do
gem 'rails_12factor'
gem 'pg'
end
gem 'sass-rails'
gem 'coffee-rails'
gem 'uglifier'
gem 'less'
gem 'less-rails'
gem 'haml'
gem 'haml-rails'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder'
gem 'twitter-bootstrap-rails'
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'designmodo-flatuipro-rails'
gem 'protected_attributes'
gem 'angularjs-rails'
group :doc do
gem 'sdoc', require: false
end
You could try therubyracer_for_windows, it packages the v8 dll.
Related
Im using windows 10 on this project with ruby version 2.6.5 and rails version 6.0.2 with bundler version 2.1.4.
However if I tried bundle install including gem 'recommendify', it will fail.
I tried deleting the old lock file then executing bundle install but issue still occurs.
I also tried re-installing ruby with development kit but still same problem.
Here is my Gemfile:
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git"
ruby '~> 2.6.5'
gem 'rails', '~> 6.0.2'
gem 'mysql2'
gem 'puma', '~> 3.11'
gem 'sass-rails', '~> 5.0'
gem 'webpacker', '~> 4.0'
gem 'coffee-rails', '~> 5.0.0'
gem 'jquery-rails'
gem 'jbuilder', '~> 2.7'
gem 'sdoc', '~> 1.0', group: :doc
gem 'bootsnap', '>= 1.4.2', require: false
gem 'devise'
gem 'devise-two-factor'
gem 'rqrcode'
gem 'kaminari'
gem 'settingslogic'
gem 'paperclip'
gem 'rest-client', require: false
group :development, :test, :staging do
gem 'pry-rails'
gem 'pry-doc'
gem 'pry-byebug'
gem 'pry-stack_explorer'
end
gem 'ransack'
gem 'active_link_to'
gem 'gretel'
gem 'whenever'
gem 'meta-tags', '~> 2.11.1'
gem 'just-datetime-picker'
gem 'jquery-ui-rails'
gem 'kakurenbo-puti'
gem 'jpmobile'
gem 'slim-rails'
gem 'html2slim'
gem 'sitemap_generator'
gem 'devise_invitable'
gem 'font-awesome-rails'
gem 'wicked_pdf'
gem 'wkhtmltopdf-binary' if RUBY_PLATFORM =~ /darwin/
gem 'carrierwave', '~> 2.0'
gem 'draper'
gem 'wkhtmltopdf-binary-edge-alpine', '~> 0.12.5.0' if RUBY_PLATFORM =~ /linux/
gem 'impressionist'
gem 'exception_notification'
gem 'slack-notifier'
gem 'redis', '~> 3.3.3'
gem 'redis-namespace'
gem 'recommendify'
gem 'active_hash'
gem 'wareki'
gem 'tzinfo-data'
gem 'mimemagic', github: 'mimemagicrb/mimemagic', ref: '01f92d86d15d85cfd0f20dabd025dcbd36a8a60f'
group :development do
gem 'ruby_dig', '~> 0.0.2'
end
gem 'kramdown'
gem 'remotipart'
gem 'aws-sdk-s3', '~> 1'
gem 'nested_form'
gem 'enum_help'
gem 'i18n_generators'
gem 'split', require: 'split/dashboard'
group :development, :test, :staging do
gem 'byebug'
end
group :development, :staging do
gem 'web-console', '~> 3.0'
end
group :production, :staging do
gem 'fog-aws'
end
group :development do
gem 'bullet'
gem 'foreman', require: false
gem 'letter_opener'
gem 'letter_opener_web'
gem 'rubocop', require: false
gem 'rubocop-airbnb'
gem 'rails-erd'
gem 'slim_lint'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
group :development, :test do
gem 'rspec-rails'
gem 'factory_bot_rails'
gem 'faker'
gem 'spring-commands-rspec'
end
group :test do
gem 'database_cleaner'
gem 'timecop'
gem 'simplecov', '~> 0.21.2', require: false
gem 'capybara'
gem 'launchy'
gem 'selenium-webdriver'
gem 'webdrivers'
end
Here is where the error begins:
Using redis 3.3.5
Fetching recommendify 0.3.8
Installing recommendify 0.3.8 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: C:/Ruby26/lib/ruby/gems/2.6.0/gems/recommendify-0.3.8/ext
C:/Ruby26/bin/ruby.exe -I C:/Ruby26/lib/ruby/2.6.0 -r
./siteconf20210510-3880-ihgz9k.rb extconf.rb
current directory: C:/Ruby26/lib/ruby/gems/2.6.0/gems/recommendify-0.3.8/ext
make "DESTDIR=" clean
rm -f *.o
current directory: C:/Ruby26/lib/ruby/gems/2.6.0/gems/recommendify-0.3.8/ext
make "DESTDIR="
mkdir -p ../bin
gcc -Wall recommendify.c -lhiredis -o ../bin/recommendify
recommendify.c:4:10: fatal error: hiredis/hiredis.h: No such file or directory
4 | #include <hiredis/hiredis.h>
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:4: build] Error 1
make failed, exit code 2
Gem files will remain installed in
C:/Ruby26/lib/ruby/gems/2.6.0/gems/recommendify-0.3.8 for inspection.
Results logged to
C:/Ruby26/lib/ruby/gems/2.6.0/extensions/x86-mingw32/2.6.0/recommendify-0.3.8/gem_make.out
An error occurred while installing recommendify (0.3.8), and Bundler cannot
continue.
Make sure that `gem install recommendify -v '0.3.8' --source
'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
recommendify
Thanks in advance. Kind of new to ruby.
The recommendify gem requires the hiredis client to be installed on the system (and its development headers) to be available. See https://github.com/asmuth/recommendify/issues/8
https://github.com/JaneaSystems/hiredis-windows may be a usable version for Windows. However, you may possibly find other roadblocks which getting this to run on Windows. It might be easier to use Linux or macOS here if possible.
In any case, it appears the the recommendify gem was not updated for 8 years now and thus might show a lot of other incompatibilities with newer software (such as Redis, Ruby, or other gems). If possible, you may investigate on updating to a different maintained library to generate your recommendations.
UPDATED: Per Michael's suggestion/comment, I am reformatting below display code. I also made the minor fixes on code like rails which was commented out and also not latest. The history of the Gemfile dates back to Michael Hartl's RoR tutorial - I had made an app using it but not touched in last 2 years.
Now I have run bundle update which resulted in a lot of things getting updated which was nice. However at the end it gave me the same error as before - see below pls. Any further advice would be great pls. Thank you.
Installing puma 3.12.6 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
....
An error occurred while installing puma (3.12.6), and Bundler cannot continue.
Make sure that `gem install puma -v '3.12.6' --source 'https://rubygems.org/'` succeeds before bundling.
Pls see below my Gemfile.
source 'https://rubygems.org'
ruby "2.6.3"
gem 'rails', '5.0.7.2'
gem 'will_paginate', '3.1.0'
gem 'bootstrap-will_paginate', '0.0.10'
gem 'faker', '1.6.3'
gem 'carrierwave', '0.11.2'
gem 'mini_magick', '4.5.1'
gem 'fog', '1.38.0'
gem 'bcrypt', '3.1.11'
gem 'bootstrap-sass', '3.3.6'
gem 'puma', '~> 3.4'
gem 'sass-rails', '5.0.5'
gem 'uglifier', '3.0.0'
gem 'coffee-rails', '4.2.1'
gem 'jquery-rails', '>= 4.3.3'
gem 'turbolinks', '5.0.0'
gem 'jbuilder', '2.4.1'
gem 'figaro', '1.1.1'
gem 'haml'
gem 'country_select'
gem 'city-state'
gem 'redis'
gem 'devise', '>= 4.2.0'
gem 'friendly_id', '~> 5.1.0'
gem 'geoip'
gem 'bootstrap-datepicker-rails'
gem 'social-share-button'
gem 'trix'
gem 'activeadmin', '~> 1.1.0.pre3'
gem 'arctic_admin'
gem 'stripe'
gem 'money'
gem 'eu_central_bank'
gem 'newrelic_rpm'
gem 'cloudinary'
group :development, :test do
gem 'pg', '0.20.0'
gem 'byebug', '9.0.0', platform: :mri
end
group :development do
gem 'web-console', '3.1.1'
gem 'listen', '3.0.8'
gem 'spring', '1.7.2'
gem 'spring-watcher-listen', '2.0.0'
end
group :test do
gem 'rails-controller-testing', '0.1.1'
gem 'minitest-reporters', '1.1.9'
gem 'guard', '2.13.0'
gem 'guard-minitest', '2.4.4'
end
group :production do
gem 'pg', '0.20.0'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
Based on the Gemfile (note correct spelling—not GemFile), it appears that the version of Puma is wrong. If you’re using a Gemfile.lock with a different version, that could account for the error. Also, your rails gem appears to be commented out, which is unlikely to be right.
One step you’re likely to need is this:
bundle update
That being said, the version mismatch indicates that there may be deeper issues. Where did this Gemfile come from? Why is rails commented out? Etc. These are the sort of things that would help people answer your question.
Solved with the help of Michael Hartl on twitter.
Had to remove Gemfile.lock and hardcode puma version to gem 'puma', '~> 4.1' and then run bundle install.
If my website ever gets its 15mins of fame, I will be talking about Michael for the first 5 mins at least.
This is my current memory consumption on Heroku. I only have one endpoint that I see on scout being called repeatedly. It seems as if there is a lot of bloat during the startup and then it seems to plateau off later in the day. Is something like this indicative of a memory leak?
I've gone through and updated most of the gems I use to try and resolve this error. However, it's still very high and a bit concerning to me.
Here is my gem file.
source "https://rubygems.org"
ruby "2.3.1"
gem "rails", "5.0.1"
gem "aasm"
gem "active_model_serializers", "0.9.3"
gem "activeadmin-poro-decorator"
gem "activejob"
gem "api-auth"
gem "autoprefixer-rails"
gem "aws-sdk", "~> 2"
gem "axlsx", "2.1.0.pre"
gem "bcrypt"
gem "blanket_wrapper", require: "blanket"
gem "bootsnap"
gem "chroma"
gem "devise"
gem "dotenv-rails"
gem "dwolla_v2", "~> 1.1.2"
gem "foreman"
gem "geoip"
gem "httparty"
gem "jira-ruby", require: "jira-ruby"
gem "jquery-rails"
gem "kaminari"
gem "lightspeed_ruby", require: "lightspeed"
gem "mandrill-api", require: "mandrill"
gem "money-rails"
gem "omniauth"
gem "omniauth-lightspeed-pos"
gem "paid", git: "https://github.com/zamith/paid-ruby.git", branch: "zamith/support-pagination"
gem "paper_trail"
gem "paperclip"
gem "pg"
gem "phony_rails"
gem "puma"
gem "pundit"
gem "rack-attack"
gem "rack-cors", require: "rack/cors"
gem "roadie-rails", "~> 1.0"
gem "sidekiq"
gem "sidekiq-cron"
gem "simple_token_authentication", "~> 1.0"
gem "slack-notifier"
gem "slim-rails"
gem "stripe"
gem "textris"
gem "thor", "0.19.1"
gem "twilio-ruby"
gem "typhoeus"
gem "tzinfo-data"
gem "uglifier", ">= 1.3.0"
gem "validates_zipcode"
gem "webpacker", "~> 2.0"
gem "webpacker-react", "~> 0.3.1"
gem "wicked_pdf"
gem "wkhtmltopdf-binary"
gem "zepto-for-rails"
gem 'zip-codes'
gem "activeadmin", git: "https://github.com/activeadmin/activeadmin.git", ref: "01db1a"
gem "inherited_resources", git: "https://github.com/activeadmin/inherited_resources"
group :development do
gem "letter_opener"
gem "letter_opener_web"
gem "parity"
gem "rails-erd"
gem "subcontractor"
gem "web-console", "~> 2.0"
end
group :test do
gem "capybara"
gem "capybara-selenium"
gem "capybara_discoball"
gem "climate_control"
gem "codeclimate-test-reporter", "~> 1.0.0"
gem "database_cleaner"
gem "fake_stripe"
gem "fakeredis", require: "fakeredis/rspec"
gem "pdf-reader"
gem "rspec"
gem "rspec-retry"
gem "selenium-webdriver"
gem "simplecov"
gem "sinatra", "2.0.0.rc2"
gem "sinatra-contrib", "2.0.0.rc2", require: false
gem "sinatra-cross_origin"
gem "stackprof"
gem "timecop"
gem "vcr"
gem "webmock"
end
group :development, :test do
gem "factory_girl_rails"
gem "faker"
gem "headless"
gem "pry-rails"
gem "pry-remote"
gem "rspec-rails", "~> 3.4"
gem "rubocop"
gem "spring"
gem "spring-commands-rspec"
end
group :production, :staging do
gem "oj"
gem "rails_12factor"
gem "rollbar"
gem "scout_apm"
end
I'm having trouble interpreting whether this is a memory leak or memory bloat from boot.
This seems to be an ongoing issue with this gem, 2 years after this post.
I myself am experiencing memory issues with this gem.
Derailed Benchmarks
twilio-ruby: 19.0 MiB
You can track the progress here as this issues is being addressed.
https://github.com/twilio/twilio-ruby/issues/396
Try the 'Derailed Benchmarks' gem. I noticed while running mine that the twilio-ruby gem was one of the biggest memory hogs # 21MB.
https://github.com/schneems/derailed_benchmarks
I mean, users are encouraged to upgrade to rest-client 2.0, I need to upgrade for some mail api only support 2.0 version, but now I meet this problem.
When I change rest-client version to 2.0.2 in my Gemfile, and I meet this problem.
Bundler could not find compatible versions for gem "rest-client":
it seems that rest-client 2.0 version is conflict with docverter which depends on rest-client (~> 1.6.7)
So how should I do to solve? I need rest-client version to be above 2.0.
here's my Gemfile:
source 'https://rubygems.org'
ruby '2.4.1'
gem 'rails'
# Forms
gem 'wicked'
gem 'localstorageshim-rails'
gem 'simple_form'
# Monitoring
gem 'newrelic_rpm'
gem 'slack-notifier'
gem 'puma_worker_killer'
# Assets
gem 'sass-rails'
gem 'haml-rails'
gem 'uglifier'
gem 'autoprefixer-rails'
# Design
gem 'bootstrap-sass'
gem 'font-awesome-sass'
gem 'nprogress-rails'
gem 'normalize-rails'
# Markdown
gem 'marked-rails'
gem 'rdiscount'
# Javascript
gem 'react-rails'
gem 'coffee-rails'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jquery-turbolinks'
# Authentication
gem 'devise'
gem 'pundit'
# Data
gem 'pg'
# Payments
gem 'stripe'
gem 'braintree'
# Crypto
gem 'hashids'
# Images
gem 'lazyload-rails'
# Files
gem 'rest-client', '>= 2.0'
gem 'docverter'
# Utils
gem 'annotate'
gem 'jbuilder'
gem 'sdoc', group: :doc
group :development do
gem 'spring'
gem 'spring-commands-rspec'
gem 'better_errors'
gem 'binding_of_caller', :platforms=>[:mri_21]
gem 'html2haml'
gem 'hub', :require=>nil
gem 'quiet_assets'
gem 'rails_layout'
end
group :development, :test do
gem 'factory_girl_rails'
gem 'faker'
gem 'rspec-rails'
end
group :production do
gem 'rails_12factor'
gem 'puma'
gem 'heroku_rails_deflate'
gem 'rack-timeout'
end
group :test do
gem 'capybara'
gem 'database_cleaner'
gem 'launchy'
gem 'selenium-webdriver'
end
Unfortunately you can only have one version of a gem activated at a time. So when there are conflicting version dependencies like this, you have to pick one.
The latest Docverter code requires rest-client 1.x:
https://github.com/Docverter/docverter-ruby/blob/5775e5a8bc00610d3168141cc44a83b4af41717a/docverter.gemspec#L20
In this situation, your best bet is probably to make a fork changing the dependency to ~> 2.0 and issue a pull request. In the best case, the maintainers will merge your pull request quickly.
In the worst case, you can use your forked version by specifying a git URL in the Gemfile. http://bundler.io/v1.15/guides/git.html
run
bundle update rest-client
and then bundle install once rest-client is updated.
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.