I am trying to learn rails3.
I tried folowing the installation guide from guides.rails.info, I installed
sudo gem install rake rack-test rack-mount erubis mail
sudo gem install tzinfo builder i18n memcache-client
sudo gem install text-format thor
And rails 3 via
sudo gem install rails --pre
Now I create a new app
rails abc
And try
rake db:create
Which fails with
Could not find gem 'sqlite3-ruby (>= 0, runtime)' in any of the sources.
So I try installing sqlite3-ruby
sudo gem install sqlite3-ruby
Which fails with
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.
So I install it via apt-get
sudo aptitude install libsqlite3-ruby1.8.
And still get same error on rake db:create.
This can be caused by a number of things. So I have a number of questions too. ;)
Is this Debian or Ubuntu? I'm going to assume Ubuntu.
I also assume, because you tried installing libsqlite3-ruby1.8, that you are also running Ruby 1.8? Do you have any other versions of Ruby installed? And what does ruby --version say?
Ubuntu versions it's Ruby packages as ruby1.8, ruby1.9.0, and ruby1.9.1. Look for those in your package manager. The package named just ruby is a dummy that depends on whatever is the default version for Ubuntu at that time.
When you start irb and do require 'sqlite3', what is the output?
As for the gem install not working, if you want to try that again, do you have the ruby-dev and libsqlite3-dev Ubuntu packages installed?
Having played this lottery the thing I found that has worked for me after many different variations complaining about missing sqlite3 libraries:
sudo apt-get install libsqlite3-0 libsqlite3-dev
sudo gem install sqlite3-ruby
Related
I have problem trying to do bundle install nokogiri 1.7.2
I am using
gem 'rails', '4.2.4'
MacOS High Sierra version 10.13.6
Im not sure what is wrong
below is my error output:
full error output:
https://gist.github.com/axilaris/68e7df57c3e29366d7a1998eebd93517
this is where the error description:
An error occurred while installing nokogiri (1.7.2), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.7.2'` succeeds before bundling.
In Gemfile:
rails_admin was resolved to 1.1.1, which depends on
rails was resolved to 4.2.4, which depends on
actionmailer was resolved to 4.2.4, which depends on
actionpack was resolved to 4.2.4, which depends on
actionview was resolved to 4.2.4, which depends on
rails-dom-testing was resolved to 1.0.8, which depends on
nokogiri
UPDATE, didnt work with sudo gem install nokogiri
$ sudo gem install nokogiri -v '1.7.2'
Building native extensions. This could take a while...
....
Building Nokogiri with a packaged version of libxml2-2.9.4
with the following patches applied:
- 0001-Fix-comparison-with-root-node-in-xmlXPathCmpNodes.patch
- 0002-Fix-XPointer-paths-beginning-with-range-to.patch
- 0003-Disallow-namespace-nodes-in-XPointer-ranges.patch
Team Nokogiri will keep on doing their best to provide security
updates in a timely manner, but if this is a concern for you and want
to use the system library instead; abort this installation process and
reinstall nokogiri as follows:
gem install nokogiri -- --use-system-libraries
[--with-xml2-config=/path/to/xml2-config]
[--with-xslt-config=/path/to/xslt-config]
If you are using Bundler, tell it to use the option:
bundle config build.nokogiri --use-system-libraries
bundle install
Note, however, that nokogiri is not fully compatible with arbitrary
versions of libxml2 provided by OS/package vendors.
************************************************************************
Extracting libxml2-2.9.4.tar.gz into tmp/x86_64-apple-darwin17/ports/libxml2/2.9.4... OK
Running git apply with /Library/Ruby/Gems/2.3.0/gems/nokogiri-1.7.2/patches/libxml2/0001-Fix-comparison-with-root-node-in-xmlXPathCmpNodes.patch... OK
Running git apply with /Library/Ruby/Gems/2.3.0/gems/nokogiri-1.7.2/patches/libxml2/0002-Fix-XPointer-paths-beginning-with-range-to.patch... OK
Running git apply with /Library/Ruby/Gems/2.3.0/gems/nokogiri-1.7.2/patches/libxml2/0003-Disallow-namespace-nodes-in-XPointer-ranges.patch... OK
Running 'configure' for libxml2 2.9.4... OK
Running 'compile' for libxml2 2.9.4... ERROR, review '/Library/Ruby/Gems/2.3.0/gems/nokogiri-1.7.2/ext/nokogiri/tmp/x86_64-apple-darwin17/ports/libxml2/2.9.4/compile.log' to see what happened. Last lines are:
...
Maybe related to this ? https://github.com/sparklemotion/nokogiri/issues/1690
UPDATE 18.9.2018
I noticed major issue with my rails environment on my laptop. i tried to create a new rails app. nokogiri causing major issues to my environment. what is the issue and how to resolve this ?
https://gist.github.com/axilaris/03882e15d2cbd603279a654547752f9c
Sometimes this is a pain, I'm not even sure why this happens randomly. however, here is how I solve it most of the time.
brew unlink xz
gem install nokogiri
brew link xz
If that does not help, throws an error again with libxml2, you should do the following
brew install libxml2
and then
gem install nokogiri -- --use-system-libraries \
--with-xml2-include=$(brew --prefix libxml2)/include/libxml2
Sometimes happens to me as well, in which case I just install nokogiri via gem install nokogiri -v '1.7.2' as the error suggests. If that fails, try gem uninstall nokogiri -v '1.7.2' first and retry...
As mentioned by xploshioOn, use sudo gem install as last resort.
You can allow bundler to resolve dependencies again with
run brew upgrade libxml2
remove block code in Gemfile.lock file, starting from rails_admin till next blank line
save the file
run bundle install
Once, my Mac could not find the libxml2 library until I had accepted xCode's license agreement:
sudo xcodebuild -license accept
You may also want to encourage the machine to use the xCode libxml2:
gem install nokogiri -- --use-system-libraries=true --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/libxml2/
I am trying to run "bundle update", but I keep getting the error message:
An error occurred while installing rack (2.0.1), and Bundler cannot continue.
Make sure that `gem install rack -v '2.0.1'` succeeds before bundling.
Then I install rack 2.0.1:
sudo gem install rack -v 2.0.1
Successfully installed rack-2.0.1
Parsing documentation for rack-2.0.1
Done installing documentation for rack after 2 seconds
1 gem installed
Then I even ran "rbenv rehash", and I run "bundle update" again and the same error message shows up. How do I get Bundler to recognize the new gem?
Make sure you have the "bundler" installed from the ruby version installed by rbenv first. Then, check the ruby version in that directory. It should be the one that you installed from rbenv or rvm. After these, if you are installing something just don't use sudo before bundle. Because bundle is from the rbenv ruby version. If the rbenv rehash doesn't work, just restart the bash and check.
If the without sudo thing needs permission, you are most likely using the bundler that was installed by your system ruby as sudo gem install bundler.
Try reinstalling bundler without a sudo like gem install bundler and retry.
Even if that doesn't work, remove the Gemfile.lock in your directory. Remove any version of rack mentioned in your Gemfile if any. Just have the gem name like gem 'rack' and try bundle install again. The gem that you could install with sudo was stored for the system ruby, not the one you have installed through rbenv.
When you ran sudo install, your gem most probably got installed under a different directory. When using Rbenv or VRM, you shouldn't use sudo.
First of all you could try uninstalling the gem from your system gems and doing it again without sudo.
Going into extremes you could completely reinstall your rbenv with gems (and while at it switch to RVM, personally I think its easier to manage). After that try to bundle install everything again without sudo and it should work.
I started a new project named "blog"
and in the terminal i typed $cd blog
and then when i typed $rails server I got the error message
Could not find gem 'jquery-rails (>= 0) ruby' in the gems available on this machine.
What should I do?
I tried bundle install but it gives me a fatal error
I had installed ruby and rails via rvm, but without the libssl-dev package on ubunut 11.10. To remedy, I did the following:
sudo apt-get install libssl-dev
rvm remove 1.9.3 #or whatever your version of ruby is
rvm cleanup all
rvm install 1.9.3
cd to project directory
bundle install
Now I don't seem to be getting the error anymore
I've installed ruby on rails using "gem install rails" and got the message that rails has been successfully installed.
When I try to check that it has been installed successfully using "rails -v" I'm getting this error:
Could not find gem 'jquery-rails (>= 0) ruby' in any of the gem sources listed in your Gemfile.
Any ideas...?
I got this same error because I had installed ruby and rails via rvm, but without the libssl-dev package on ubunut 11.10. To remedy, I did the following:
sudo apt-get install libssl-dev
rvm remove 1.9.3 #or whatever your version of ruby is
rvm cleanup all
rvm install 1.9.3
cd to project directory
bundle install
Now I don't seem to be getting the error anymore
hi all i am getting problem while installing rails in by gem :
i have written in terminal
gem install rails
Successfully installed rails-3.0.3
1 gem installed
Installing ri documentation for rails-3.0.3...
File not found: lib
what i need to do next and how to install rails using gem.
I had the same problem. I continued with the error. I do not see anything breaking. And I can code peacefully. So, probably you do not need to worry.
sudo apt-get install build-essential libopenssl-ruby libfcgi-dev
sudo apt-get install ruby irb rubygems ruby1.8-dev
sudo apt-get install sqlite3 libsqlite3-dev
sudo gem install rails
sudo gem install sqlite3-ruby
If you dont find path do this: (for Unix based systems)
Quoted from the book, but anyone else would suggest the same
If you can’t find the rails command, you may need to add
/var/lib/gems/1.8/bin to your PATH environment variable.
You can do this by adding a line to your .bashrc file:
export PATH=/var/lib/gems/1.8/bin:$PATH
OK as aditya sanghi has mentioned, I do lack rdoc gem-- so probably running this will help
gem install rdoc rails
I've seen this error when you dont have the "rdoc" gem installed. Can you do a "gem list" and show us a list of gems installed?
Try running "gem install rdoc rails".