ruby-on-railsrubyweb-scrapingopen-uri

How to fix "Errno::ENOENT: No such file or directory @ rb_sysopen"?


Super new to coding! I created a new project with rails new.

I'm trying to scrape a website, but I am getting an error Errno::ENOENT: No such file or directory @ rb_sysopen

require 'open-uri'
require 'nokogiri'
require 'pry'

def get_page
    link = "https://www.pokemon.com/us/pokedex/"
    doc = Nokogiri::HTML(open(link))
    #rest of code
end

get_page

Any help is appreciated. Thank you!


Solution

  • link = "https://www.pokemon.com/us/pokedex/"
    doc = Nokogiri::HTML(URI.open(link))
    

    Just add the URI