Twitter Bootstrap in Ruby on Rails - ruby-on-rails

I want to integrate twitter-boostrap in my Ruby on Rails project.
For that i have written- gem "therubyracer" gem "less-rails" gem "twitter-bootstrap-rails" on my gemfile. And then bundle install in rails command prompt.
After installing less-rails. This error is comming
Gem::Installer::ExtensionBuildError: ERROR:
Failed to build gem native extension`
c:/row/Ruby200/bin/ruby.exe extconf.rb`
creating Makefile
The system cannot find the path specified.
The system cannot find the path specified.`
c:/row/Ruby200/lib/ruby/gems/2.0.0/gems/libv8-3.16.14.3/ext/libv8/builder.rb:58:
in `setup_python!': libv8 requires python 2 to be installed in order to build, b
ut it is currently not available (RuntimeError)
from c:/row/Ruby200/lib/ruby/gems/2.0.0/gems/libv8-3.16.14.3/ext/libv8/builder.rb:42:in `block in build_libv8!'
from c:/row/Ruby200/lib/ruby/gems/2.0.0/gems/libv8-3.16.14.3/ext/libv8/builder.rb:40:in `chdir'
from c:/row/Ruby200/lib/ruby/gems/2.0.0/gems/libv8-3.16.14.3/ext/libv8/builder.rb:40:in `build_libv8!'
from c:/row/Ruby200/lib/ruby/gems/2.0.0/gems/libv8-3.16.14.3/ext/libv8/location.rb:24:in `install!'
from extconf.rb:7:in `<main>'
Gem files will remain installed in c:/row/Ruby200/lib/ruby/gems/2.0.0/gems/libv8 -3.16.14.3 for inspection.
Results logged to c:/row/Ruby200/lib/ruby/gems/2.0.0/gems/libv8-3.16.14.3/ext/libv8/gem_make.out
An error occurred while installing libv8 (3.16.14.3), and Bundler cannotcontinue.
Make sure that `gem install libv8 -v '3.16.14.3'` succeeds before bundling.
Help. thanks

Remove
group :assets do
end
But keep gems mentioned inside this group, then do bundle install.
gem 'therubyracer', :platforms => :ruby
gem 'less-rails'
gem 'devise'

Related

'bundle install' keeps installing gem sqlite3 version 1.4.2 even if not in Gemfile

I need sqlite3 v1.3.9 gem installed for my app, so I add this line to the Gemfile:
gem 'sqlite3', '= 1.3.9'
However, when I run 'bundle install', it installs v1.4.2 of that gem.
I modified the above line to
gem 'sqlite3', '= 1.3.9', '< 1.4'
No joy -- sqlite v1.4.2 is installed (even if I remove any reference to 'sqlite3' from the Gemfile completely).
My Gemfile was created when I used rails new appname, so it is not fancy at all... I only added gem devise to it.
Gemfile.lock doesn't contain any reference to sqlite3. I removed it anyway and it didn't help.
As another option, I installed v1.3.9 via gem install sqlite3 -v 1.3.9 and I removed v1.4.2 with
# bundle exec gem uninstal sqlite3
Select gem to uninstall:
1. sqlite3-1.3.9
2. sqlite3-1.4.2
3. All versions
> 2
Successfully uninstalled sqlite3-1.4.2
...but as soon as I tried to add v1.3.9, I got:
# bundle add sqlite3 -v 1.3.9
[!] There was an error parsing `injected gems`: You cannot specify the same gem twice with different version requirements.
You specified: sqlite3 (~> 1.4) and sqlite3 (= 1.3.9). Bundler cannot continue.
# from injected gems:1
# -------------------------------------------
> gem "sqlite3", "= 1.3.9"
# -------------------------------------------
I'd grateful for any hints on why v1.4.2 keeps being installed and, most importantly, how do get the bundler forget about v1.4.2 and accept v1.3.9?
Thanks a lot!
There might be some gem in your app that requires sqlite3-1.4.2 and that is causing an issue with installing sqlite3-1.3.9. You should check your Gemfile.lock and look for any gem that is adding sqlite3-1.4.2 as a dependency.
There should be a gem in your app that requires sqlite3-1.4.2 and that is causing an issue with installing sqlite3-1.3.9. You should check your Gemfile.lock and look for any gem that is adding sqlite3-1.4.2 as a dependency.

Could Not Find Gem, but Gem is Installed without Problems

Whenever I run the rails server or the specs, I get this error:
Could not find debugger-1.6.8 in any of the sources
When I run gem install debugger, it works just fine:
Building native extensions. This could take a while...
Successfully installed debugger-1.6.8
1 gem installed
Installing ri documentation for debugger-1.6.8...
Installing RDoc documentation for debugger-1.6.8...
(eval):5: warning: regular expression has ']' without escape: /\[a-z]+/
but the bundler list doesn't show debugger-1.6.8:
* daemons (1.2.3)
* delayed_job (4.0.3)
* delayed_job_active_record (4.1.0)
* diff-lcs (1.2.5)
* domain_name (0.5.25)
* double-bag-ftps (0.1.2)
I also don't have a .bundle/config file that is preventing any gems from being installed.
Here is my Gemfile with the :test and :development group:
group :test, :development do
gem 'sqlite3', '1.3.9'
gem 'rspec-rails', '~> 2.14.2'
gem 'pry'
gem 'awesome_print', '1.2.0'
gem 'debugger', platform: :mri_19
gem 'byebug' if RUBY_VERSION >= '2.0.0'
end
When i remove the platform specification, i get this error:
An error occurred while installing debugger (1.6.8), and Bundler cannot continue.
Make sure that `gem install debugger -v '1.6.8'` succeeds before bundling.
I am running ruby 1.9.3-p551 with rbenv.
How do I get the debugger gem installed into the project bundle so I can run my server and tests?
Re-install your bundler gem and rbenv (via brew). Sometimes these installations can go bad, and the permissions on your machine will be sad when bundler and rbenv go to set your gems.

Nokogiri and Rails wont install. [Ruby On Rails]

So I have been following this guide to learn ruby on rails. I just installed ubuntu and was making an effort to install the required gear but I am facing a lot of problems. I tried searching online but couldn't really find a solution. So basically, Im following this guide (https://www.railstutorial.org/book), and I was learning how to make my first app.
There was this point after installing lots and lots of stuff where I was asked to modify the gemfile with the following text.
source 'https://rubygems.org'
gem 'rails', '4.2.0.rc3'
gem 'sass-rails', '5.0.0.beta1'
gem 'uglifier', '2.5.3'
gem 'coffee-rails', '4.1.0'
gem 'jquery-rails', '4.0.0.beta2'
gem 'turbolinks', '2.3.0'
gem 'jbuilder', '2.2.3'
gem 'sdoc', '0.4.0', group: :doc
group :development, :test do
gem 'sqlite3', '1.3.9'
gem 'byebug', '3.4.0'
gem 'web-console', '2.0.0.beta3'
gem 'spring', '1.1.3'
end
And I had ruby before itself but it was outdated so I updated it to 2.1.5.
Now when I used the command "bundle install" it gave me errors saying it couldnt install rails and nokogiri. I tried installing rails and nokogiri seperately too but it didnt work out.
Here's the error:
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/usr/bin/ruby2.1 -r ./siteconf20141220-9232-x08jtr.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.1.0/gems/nokogiri-1.6.5 for inspection.
Results logged to /var/lib/gems/2.1.0/extensions/x86_64-linux/2.1.0/nokogiri-1.6.5/gem_make.out
And for rails:
Fetching: rack-1.6.0.gem (100%)
Successfully installed rack-1.6.0
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/usr/bin/ruby2.1 -r ./siteconf20141220-9321-6z0v97.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.1.0/gems/nokogiri-1.6.5 for inspection.
Results logged to /var/lib/gems/2.1.0/extensions/x86_64-linux/2.1.0/nokogiri-1.6.5/gem_make.out
What is happening ? And please do give me a detailed solution because I'm quite new to this.
Thanks for the help in Advance !
It sounds like you didn't install the ruby-dev libraries. So you've got a Ruby VM, but not the libraries required to build gems. Try installing the ruby-dev package.
sudo apt-get install ruby-dev
And then rebundle.
First off, don't try to use the system Ruby for development. That Ruby version is packaged to run specific system level packages for the OS, you can break OS utils by manually updating it or a OS update can break your dev environment. Plus, it will most likely require you run everything as sudo which is just a pain. I recommend installing rvm or rbenv for managing your development rubies.
Now, as for your specific error, you probably just need to install libxml development packages for Ubuntu:
sudo apt-get install libxslt-dev libxml2-dev

Rails 4: Error when installing tiny_tds gem?

I have developed a rails web project with Ruby v2 and Rails v4. It was perfectly working in my current system and when i tried to run this project in another Linux machine (Ubuntu 12.4 ) i am getting a Tidy_tds error .
This error is showing at the time of bundle install ,
Error Details below
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/home/action/.rvm/rubies/ruby-2.1.1/bin/ruby extconf.rb
checking for iconv_open() in iconv.h... yes
checking for sybfront.h... no
-----
freetds is missing.
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/home/action/.rvm/rubies/ruby-2.1.1/bin/ruby
--enable-lookup
--disable-lookup
--with-iconv-dir
--without-iconv-dir
--with-iconv-include
--without-iconv-include=${iconv-dir}/include
--with-iconv-lib
--without-iconv-lib=${iconv-dir}/lib
--with-freetds-dir
--without-freetds-dir
--with-freetds-include
--without-freetds-include=${freetds-dir}/include
--with-freetds-lib
--without-freetds-lib=${freetds-dir}/lib
extconf failed, exit code 1
Gem files will remain installed in /home/action/.rvm/gems/ruby-2.1.1/gems/tiny_tds-0.6.1 for inspection.
Results logged to /home/action/.rvm/gems/ruby-2.1.1/extensions/x86_64-linux/2.1.0/tiny_tds-0.6.1/gem_make.out
An error occurred while installing tiny_tds (0.6.1), and Bundler cannot continue.
Make sure that `gem install tiny_tds -v '0.6.1'` succeeds before bundling.
I have also tried installing tiny_tds seperatly, but still i am getting the same issue
gem install tiny_tds -v '0.6.1'
My gem file,
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.2'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
gem 'tiny_tds'
# 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'
gem 'jquery-ui-rails' # jquery ui
# 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
# Use sqlserver as the database for Active Record
gem 'activerecord-sqlserver-adapter', :git => 'https://github.com/nextgearcapital/activerecord-sqlserver-adapter.git'
gem "therubyracer"
gem "less-rails"
gem "twitter-bootstrap-rails"
gem 'bootstrap-datepicker-rails'
gem 'will_paginate'
gem 'sqlite3'
gem 'formtastic'
Why is this error appearing and how to solve this issue.
Any help is appreciated
Looks like you don't have freetds installed on this machine:
sudo apt-get install freetds-dev
If you see the details of the freetds-dev package you will see it has the missing file sybfront.h
There is no gem that I know for freetds and building the tiny_tds gem requires it to compile. However it should be possible for you build your own version of the gem using MiniPortile.
Rather than using the normal gem install mechanism you need to clone the tiny_tds from GitHub and then build a native gem for your environment. This process will include downloading a specific version of freetds which is used to compile the gem against.
This should get you round the problem of not being able to install freetds-dev package, but does have the disadvantage that if tiny_tds gem is updated in the future you will need to repeat this process each time - you can't simply take advantage of bundle update.
The steps you need to follow are detailed here.
For MacOS you need additional lib installed.
brew install freetds
This worked for me in Ubuntu 17.04
Install wget to download packages from remote URL
$ sudo apt-get install wget
Install dependencies
$ sudo apt-get install build-essential
$ sudo apt-get install libc6-dev
Download remote file
$ wget ftp://ftp.freetds.org/pub/freetds/stable/freetds-1.00.21.tar.gz
Unzip
$ tar -xzf freetds-1.00.21.tar.gz
Configure and Run Test for the package in your system
$ cd freetds-1.00.21
$ sudo ./configure --prefix=/usr/local --with-tdsver=7.3
$ sudo make
Now, Install
$ sudo make install
Now install the gem
$ gem install tiny_tds -v '2.0.0'
If still, you cannot install the gem tiny_tds then try using sudo
$ sudo gem install tiny_tds -v '2.0.0'
Output
Building native extensions. This could take a while...
Successfully installed tiny_tds-2.0.0
Parsing documentation for tiny_tds-2.0.0
Installing ri documentation for tiny_tds-2.0.0
Done installing documentation for tiny_tds after 1 seconds
1 gem installed

Nokogiri gem installation error with spree

I'm getting this error when I try to bundle install
Bundler::GemspecError: Could not read gem at /home/theareba/.rvm/gems/ruby-2.0.0-p353/cache/nokogiri-1.6.1.gem. It may be corrupted.
An error occurred while installing nokogiri (1.6.1), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.6.1'` succeeds before bundling.
I've tried removing nokogiri in the cache and bundle installing again in vain.
Here's my gemfile
source 'https://rubygems.org'
gem 'rails', '4.0.0'
ruby "2.0.0"
gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '2-1-stable'
gem 'spree', github: 'spree/spree', branch: '2-1-stable'
gem 'bootstrap-sass', '2.3.2.0'
gem 'sass-rails'
gem 'uglifier'
gem 'coffee-rails'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder'
group :development, :test do
gem 'turn', :require => false
gem 'sqlite3'
gem 'taps', :require => false
gem 'rspec-rails'
end
group :production do
gem 'pg', '0.15.1'
gem 'rails_12factor'
end
UPDATE
Error that occurs when I run gem install nokogiri -v '1.6.0'
Fetching: mini_portile-0.5.2.gem (100%)
Fetching: nokogiri-1.6.0.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:5:in `<main>'
Gem files will remain installed in /var/lib/gems/1.9.1/gems/nokogiri-1.6.0 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/nokogiri-1.6.0/ext/nokogiri/gem_make.out
Note: I've installed both libxslt1-dev and libxml2-dev that are requirements in nokogiri installation.
I've also tried gem install nokogiri -v '1.6.1' but it still fails. I've installed nokogiri -v 1.5.0 in another app so I tried it in this app and got the error that spree requires nokogiri version 1.6.0 or greater. I'm I missing something?
So here's what solved my problem. I created a new gemset i.e
rvm gemset create nokogiri
rvm use ruby-2.0.0-p353#nokogiri
Note: I'm using rvm and ruby 2.0.0. Then I made sure I've got necessary lib installed by running
sudo apt-get install libxml2-dev libxslt-dev
The libraries happened to be already installed. Then I installed nokogiri
gem install nokogiri -v '1.6.1'
It installed successfully. And finally ran bundle install to get all my gems. Hope this helps anyone having the same issue.
Check the RVM gemset. I fixed it by restoring the gemset. If you try upgrading to 4.0.2? I used Nokogiri 1.6.1 with Ruby 2.0.0 and Rails 4.0.2
try this
sudo apt-get install ruby-dev
sudo apt-get install libxml2 libxml2-dev libxslt1-dev
and reinstall nokogiri
sudo gem install nokogiri

Resources