Loading a gem in file.rb file

i installed aws-sdk gem
when i am doing require ‘aws-sdk’ in file.rb

i am getting below error
in `require’: cannot load such file – aws-sdk (LoadError)

From your command line, do a gem list. Does your aws-sdk gem appear in the output? Can you 'require' any of the other gems you have installed? You might need to use bundler. See [bundler.io]

i have listed out gems , in the list aws-sdk gem is present ,
then also it is giving same error

If you are using sudo gem install aws-sdk, sometimes it doesn’t work on all systems. For example on Arch Linux, I use gem install gemname and then run require 'gemname' to require it. If I ran sudo gem install gemname I need to run the ruby script or irb as root user. Because the gems are installed in local directory in case of me.

To get where the gem installed, run gem which aws-sdk. If you see something like /root/.gem/ruby/2.7.0/gems/aws-version.version/lib/aws-sdk.rb, probably it’s installed as root, try running gem install aws-sdk without sudo.

i am working on windows,
i have installed gem using the command (gem install aws-sdk).
then also i am getting same error in .rb file

Oh I have no ideas about windows. Only installed Ruby once on windows a couple of years back… Then nuked the virtual machine… So can’t really help…

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs