in my terminal
pt@pt-laptop:~$ gem
RubyGems is a sophisticated package manager for Ruby. This is a
basic help message containing pointers to more information.
Examples:
gem install rake
gem list --local
gem build package.gemspec
gem help install
Further help:
gem help commands list all 'gem' commands
gem help examples show some examples of usage
gem help platforms show information about platforms
gem help <COMMAND> show help on COMMAND
(e.g. 'gem help install')
gem server present a web page at http://localhost:8808/
with info about installed gems
Further information: http://rubygems.rubyforge.org
pt@pt-laptop:~$ gem install nokogiri
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the
/usr/local/ruby/lib/ruby/gems/1.9.1 directory.
pt@pt-laptop:~$ sudo gem install nokogiri
sudo: gem: command not found
how can i install nokogiri in my computer?what's wrong with my computer?
On Wed, Mar 24, 2010 at 11:34 AM, Pen Ttt <myocean135@yahoo.cn> wrote:
in my terminal
pt@pt-laptop:~$ gem
RubyGems is a sophisticated package manager for Ruby. This is a
basic help message containing pointers to more information.
Examples:
gem install rake
gem list --local
gem build package.gemspec
gem help install
Further help:
gem help commands list all 'gem' commands
gem help examples show some examples of usage
gem help platforms show information about platforms
gem help <COMMAND> show help on COMMAND
(e.g. 'gem help install')
gem server present a web page at http://localhost:8808/
with info about installed gems
Further information: http://rubygems.rubyforge.org
pt@pt-laptop:~$ gem install nokogiri
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the
/usr/local/ruby/lib/ruby/gems/1.9.1 directory.
pt@pt-laptop:~$ sudo gem install nokogiri
sudo: gem: command not found
how can i install nokogiri in my computer?what's wrong with my computer?
--
Posted via http://www.ruby-forum.com/\.
i use the command to install nokogiri successfully
sudo /usr/local/ruby/bin/gem install nokogiri,
can i change something in order to use command :sudo gem install any
other thing?
i have installed nokogiri with command:
sudo /usr/local/ruby/bin/gem install nokogiri
but there is another problem i can not solve:
i can run the script on my terminal
require 'nokogiri'
require 'open-uri'
doc = Nokogiri::HTML(open('http://www.huomo.cn'))
doc.search("//h2/a").each do |link|
puts link.inner_text
puts link[:href]
end
but i can not run it on my netbean ide 6.8
the ouput is :
/home/pt/NetBeansProjects/test/lib/main.rb:4:in `require': no such file
to load -- nokogiri (LoadError)
from /home/pt/NetBeansProjects/test/lib/main.rb:4
what can i do now?
Netbeans comes with it's own JRuby installation which can't share gems
with the "official" Ruby. You need to tell Netbeans about your
installation of Ruby by going to tools and selecting Ruby Platforms.
Also for any existing projects you will need to change the platform the
run on in the projects properties.
···
On 3/24/2010 5:04 AM, Pen Ttt wrote:
i have installed nokogiri with command:
sudo /usr/local/ruby/bin/gem install nokogiri
but there is another problem i can not solve:
i can run the script on my terminal
require 'nokogiri'
require 'open-uri'
doc = Nokogiri::HTML(open('http://www.huomo.cn'))
doc.search("//h2/a").each do |link|
puts link.inner_text
puts link[:href]
end
but i can not run it on my netbean ide 6.8
the ouput is :
/home/pt/NetBeansProjects/test/lib/main.rb:4:in `require': no such file
to load -- nokogiri (LoadError)
from /home/pt/NetBeansProjects/test/lib/main.rb:4
what can i do now?
Simple, since you've used gem to install nokogiri, you've to add: require 'rubygems' before require 'nokogiri' or ruby -rrubygems script.rb ...
But keep a look at this post, http://tomayko.com/writings/require-rubygems-antipattern
···
Il 24/03/10 12.04, Pen Ttt ha scritto:
i have installed nokogiri with command:
sudo /usr/local/ruby/bin/gem install nokogiri
but there is another problem i can not solve:
i can run the script on my terminal
require 'nokogiri'
require 'open-uri'
doc = Nokogiri::HTML(open('http://www.huomo.cn'))
doc.search("//h2/a").each do |link|
puts link.inner_text
puts link[:href]
end
but i can not run it on my netbean ide 6.8
the ouput is :
/home/pt/NetBeansProjects/test/lib/main.rb:4:in `require': no such file
to load -- nokogiri (LoadError)
from /home/pt/NetBeansProjects/test/lib/main.rb:4
what can i do now?