Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LoadError for dotenv/load while Dotenv.load works

Tags:

ruby

I want to use dotenv in pure ruby environments. I mean I'm not using Rails.

The github instruction says there are two ways for loading the variables.

require 'dotenv/load'

# or
require 'dotenv'
Dotenv.load

In my environments the latter way works, but `require 'dotenv/load' raises the this error:

LoadError: cannot load such file -- dotenv/load

I gonna use Dotenv.load if former way doesn't work, but I want to know the reason of the error.

I'm using ruby 2.3.3p222 and dotenv (2.1.1). What am I doing wrong?

Additional Info

I'm using bundle exec pry and `load 'myapp.rb'. When I load the script I get the error.

like image 830
ironsand Avatar asked Nov 24 '17 09:11

ironsand


1 Answers

'dotenv/load' is implemented from 2.1.2 or 2.2.0.

To upgrade the dotenv gem is needed.

like image 122
ironsand Avatar answered Sep 22 '22 20:09

ironsand