4

I'm using Ubuntu 18.04, Ruby 2.6.3, and Rails 6. I'm working on a new rails project, and when i start the server, i have the following error :

> rails s

=> Booting Puma
=> Rails 6.0.2.1 application starting in development 
=> Run `rails server --help` for more startup options
Exiting
Traceback (most recent call last):
    [...]
    72: from ./bin/rails:3:in `<main>'
    71: from ./bin/rails:3:in `load'
    70: from /home/franck/code/BTC1M/app-test/bin/spring:15:in `<top (required)>'
    69: from /home/franck/.rbenv/versions/2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    68: from /home/franck/.rbenv/versions/2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    67: from /home/franck/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `<top (required)>'
    66: from /home/franck/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `load'
[...]
5: from /home/franck/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.2.1/lib/active_support/lazy_load_hooks.rb:69:in `block in execute_hook'
4: from /home/franck/.rvm/gems/ruby-2.6.3/gems/less-rails-2.6.0/lib/less/rails/railtie.rb:17:in `block in <class:Railtie>'
3: from /home/franck/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:58:in `load_missing_constant'
2: from /home/franck/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:79:in `rescue in load_missing_constant'
1: from /home/franck/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:8:in `without_bootsnap_cache'
/home/franck/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:79:in `block in load_missing_constant': uninitialized constant Sprockets::Engines (NameError)

I tried to uninstall and re-install rails and ruby (through those steps) :

rvm implode
rm -rf ~/.rvm
rm -rf ~/.rbenv
sudo apt install -y build-essential tklib zlib1g-dev libssl-dev libffi-dev libxml2 libxml2-dev libxslt1-dev libreadline-dev
sudo apt clean
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
rbenv install 2.6.3
rbenv global 2.6.3
gem install rails

I also tried spring stop, and updating sprockets and sprockets-rails : gem update (my sprockets-rails version is 3.2.1), and updating the sprockets-rails version in Gemfile.lock : sprockets-rails (3.2.1). My sprockets version is 4.0.0.

I also added gem 'sprockets', git: 'git://github.com/rails/sprockets' in my gemfile + bundle install (as it was told on this thread : https://github.com/rails/sass-rails/issues/48 ) but it doesn't fix my issue.

I still have the same error. I don't understand what is going on. Any idea ?

By the way, why do i have a /home/franck/.rvm folder (that i deleted before) as i'm not using RVM but RBENV ?

The github repo is here : https://github.com/BTC1M/app-test

Franck Robin
  • 115
  • 8
  • try running `spring stop` or check if there's any `spring` process running on the machine and kill it – arieljuod Dec 25 '19 at 23:48
  • Does this answer your question? [How can I remove RVM (Ruby Version Manager) from my system?](https://stackoverflow.com/questions/3558656/how-can-i-remove-rvm-ruby-version-manager-from-my-system) – Thomas Koppensteiner Dec 26 '19 at 11:08

1 Answers1

1

Try removing one by one those old dependencies that might not be compatible with rails > 5, and bundle again:

  • Start with gem 'less-rails-bootstrap' which last commit is 5 years ago, and which is referenced in your error stack.

Also look at those other dependencies:

  • gem 'jquery-easing-rails' last commit is 5 yo
  • gem "font-awesome-rails" last commit 3 yo

Also note that bootstrap-sass and font-awesome-rails doesn't support latest versions of those libraries, and might need some hacking to work on Rails 6, you'd better use those librairies with webpack which is the new standard (Sprocket does not handle JS by default anymore, everything happens in app/javascript which is compiled by webpack).

And, you might not need therubyracer anymore (last commit 3 yo and a lot of recent issues).

adesurirey
  • 2,549
  • 2
  • 16
  • 36