Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lit.init returns nil therefore installation process fails #124

Open
eduarmreyes opened this issue Dec 19, 2018 · 5 comments
Open

Lit.init returns nil therefore installation process fails #124

eduarmreyes opened this issue Dec 19, 2018 · 5 comments
Assignees

Comments

@eduarmreyes
Copy link

I'm not sure if this is regarding the version of my development environment but I can't finish the installation process.

ruby --version
ruby 2.3.6p384 (2017-12-14 revision 61254) [x86_64-linux]

rails --version
Rails 4.2.11

Error is

➜ bundle exec rails g lit:install
What's the authentication function, ie. :authenticate_user! : :authenticate_user!
What's the key value engine? ([hash] OR redis): hash
Skipping config/initializers/lit.rb creation, file already exists!
Running rake db:migrate
~/.rvm/gems/ruby-2.3.6/gems/lit-0.3.3/lib/generators/lit/install_generator.rb:57:in `clear_cache': undefined method `cache' for nil:NilClass (NoMethodError)
	from ~/.rvm/gems/ruby-2.3.6/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
	from ~/.rvm/gems/ruby-2.3.6/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
	from ~/.rvm/gems/ruby-2.3.6/gems/thor-0.20.3/lib/thor/invocation.rb:133:in `block in invoke_all'
	from ~/.rvm/gems/ruby-2.3.6/gems/thor-0.20.3/lib/thor/invocation.rb:133:in `each'
	from ~/.rvm/gems/ruby-2.3.6/gems/thor-0.20.3/lib/thor/invocation.rb:133:in `map'
	from ~/.rvm/gems/ruby-2.3.6/gems/thor-0.20.3/lib/thor/invocation.rb:133:in `invoke_all'
	from ~/.rvm/gems/ruby-2.3.6/gems/thor-0.20.3/lib/thor/group.rb:232:in `dispatch'
	from ~/.rvm/gems/ruby-2.3.6/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
	from ~/.rvm/gems/ruby-2.3.6/gems/railties-4.2.11/lib/rails/generators.rb:157:in `invoke'
	from ~/.rvm/gems/ruby-2.3.6/gems/railties-4.2.11/lib/rails/commands/generate.rb:13:in `<top (required)>'
	from ~/.rvm/gems/ruby-2.3.6/gems/activesupport-4.2.11/lib/active_support/dependencies.rb:274:in `require'
	from ~/.rvm/gems/ruby-2.3.6/gems/activesupport-4.2.11/lib/active_support/dependencies.rb:274:in `block in require'
	from ~/.rvm/gems/ruby-2.3.6/gems/activesupport-4.2.11/lib/active_support/dependencies.rb:240:in `load_dependency'
	from ~/.rvm/gems/ruby-2.3.6/gems/activesupport-4.2.11/lib/active_support/dependencies.rb:274:in `require'
	from ~/.rvm/gems/ruby-2.3.6/gems/railties-4.2.11/lib/rails/commands/commands_tasks.rb:123:in `require_command!'
	from ~/.rvm/gems/ruby-2.3.6/gems/railties-4.2.11/lib/rails/commands/commands_tasks.rb:130:in `generate_or_destroy'
	from ~/.rvm/gems/ruby-2.3.6/gems/railties-4.2.11/lib/rails/commands/commands_tasks.rb:50:in `generate'
	from ~/.rvm/gems/ruby-2.3.6/gems/railties-4.2.11/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
	from ~/.rvm/gems/ruby-2.3.6/gems/railties-4.2.11/lib/rails/commands.rb:17:in `<top (required)>'
	from bin/rails:4:in `require'
	from bin/rails:4:in `<main>'

Error is raised in this line of code:

      def clear_cache
        Lit.init.cache.reset
      end

Rails console test

➜ rails c
Loading development environment (Rails 4.2.11)
[1] pry(main)> Lit.init
=> nil
@colinramsay
Copy link

I also see this on Rails 5.1. It did work once, then I needed to reinstall, and when I did so I saw this problem.

@colinramsay
Copy link

I partially resolved this. First time round the lit migrations failed to run. When I sorted that issue, I ran the install again twice and it all worked...

@ysf
Copy link

ysf commented Aug 18, 2019

Here it seems to have to do with Lit:Locale.table_exists? although it exists in the database, it returns false, therefore Lit:init failes and hell breaks loose.

@jhovad
Copy link

jhovad commented Apr 3, 2021

There are new releases but this install problem still exist :-( ruby 2.7.1, rails 6.1.3

@pnikrat pnikrat self-assigned this Dec 24, 2021
@ralfclaassens
Copy link

I ran into this issue as well. My solution was just to run rails db:migrate in order to make sure the Lit database tables exist. The reason that rails app does not warn to run the migrations is probably:

config.paths['db/migrate'].expanded.each { |expanded_path| app.config.paths['db/migrate'] << expanded_path }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants