开发者

How does Ruby (on Windows) find your Requires (libraries)

开发者 https://www.devze.com 2023-01-12 20:05 出处:网络
What technique does a ruby script use to find your libraries / requires on Windows. I have an install of Ruby 1.8.7 on Windows to the path C:\\Ruby187 and non of my \"requires\" work.

What technique does a ruby script use to find your libraries / requires on Windows.

I have an install of Ruby 1.8.7 on Windows to the path C:\Ruby187 and non of my "requires" work.

For example, just a test file

require "rack"

gives no such file to load -- rack (LoadEr开发者_C百科ror)

gem list rack is there


Try

require 'rubygems'
require 'rack'

I believe that in Ruby 1.9+, you no longer have to require 'rubygems', but it is necessary on <= 1.8.

Otherwise, $: is the "Load path for scripts and binary modules by load or require".

0

精彩评论

暂无评论...
验证码 换一张
取 消