Error when creating a Jekyll project - ruby-on-rails

When I run jekyll new . I have get this error:
Traceback (most recent call last):
11: from /usr/local/bin/jekyll:23:in `<main>'
10: from /usr/local/bin/jekyll:23:in `load'
9: from /var/lib/gems/2.5.0/gems/jekyll-3.8.3/exe/jekyll:8:in `<top (required)>'
8: from /usr/local/lib/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
7: from /usr/local/lib/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
6: from /var/lib/gems/2.5.0/gems/jekyll-3.8.3/lib/jekyll.rb:33:in `<top (required)>'
5: from /usr/local/lib/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
4: from /usr/local/lib/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
3: from /var/lib/gems/2.5.0/gems/addressable-2.5.2/lib/addressable/uri.rb:21:in `<top (required)>'
2: from /usr/local/lib/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:39:in `require'
1: from /usr/local/lib/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
/usr/local/lib/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `require': cannot load such file -- public_suffix (LoadError)
error just for jekyll new . and jekyll new blog worked successfuly
( i tested jekyll new . --force but problem is unsolved
and my PATH is:
/home/shahrvand/.nvm/versions/node/v8.11.4/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/shahrvand/.gem/ruby/2.5.0
and my ruby version is:
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]
gem version : 2.7.7
jekyll 3.8.3
I'm using Ubuntu 18.04. What does this error mean?

Looks like you are missing the public_suffix gem. Try installing via gem install public_suffix or put it into your Gemfile and re-run bundle install.

Related

How to install Rails when dealing with "Load Error with Gems"

I am trying to get Ruby on Rails working on my laptop and haven't been able to. At some point I took some bad advice and used sudo and have been trying to undo that error and the corresponding issues since.
As of right now, ruby -v shows
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin19]
So, I think Ruby is installed. When I try to run gem install rails or any other gem command like gem install bundler, I get this error
Error loading RubyGems plugin "/Users/audreybrooke/.rvm/rubies/ruby-2.6.5/lib/ruby/gems/2.6.0/gems/executable-hooks-1.6.0/lib/rubygems_plugin.rb": cannot load such file -- executable-hooks/wrapper (LoadError)
Error loading RubyGems plugin "/Users/audreybrooke/.rvm/rubies/ruby-2.6.5/lib/ruby/gems/2.6.0/gems/gem-wrappers-1.4.0/lib/rubygems_plugin.rb": cannot load such file -- gem-wrappers (LoadError)
/Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/yaml.rb:3: warning: It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
Traceback (most recent call last):
20: from /Users/audreybrooke/.rbenv/versions/2.7.1/bin/gem:21:in `<main>'
19: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/gem_runner.rb:44:in `run'
18: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/gem_runner.rb:79:in `do_configuration'
17: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/gem_runner.rb:79:in `new'
16: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/config_file.rb:182:in `initialize'
15: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/config_file.rb:332:in `load_file'
14: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems.rb:710:in `load_yaml'
13: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
12: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
11: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/yaml.rb:4:in `<top (required)>'
10: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
9: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
8: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/psych.rb:15:in `<top (required)>'
7: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
6: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
5: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/psych/nodes.rb:2:in `<top (required)>'
4: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
3: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
2: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/psych/nodes/node.rb:2:in `<top (required)>'
1: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
/Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require': incompatible library version - /Users/audreybrooke/.rvm/rubies/ruby-2.6.5/lib/ruby/gems/2.6.0/gems/stringio-0.1.0/lib/stringio.bundle (LoadError)
It's because you have not installed libyaml correctly. Since you are using MacOS, maybe install it using homebrew can solve the problem.
brew install libyaml && brew link libyaml
I recommending to use rvm. It handle these like of dependency problems under the hood.
I did
sudo rm -rf ~/.rvm
because I had rvm and rbenv installed and that worked

Problem making bundle install in the console when i change from ruby 2.3.7 to ruby 2.5

i already try a lot o diferent way but cant solve this problem
.it seems that i cant install gems but i cant figure out why
already try with gem install bundler but steel doestn work
taller_integracion git:(develop) bundle install
Traceback (most recent call last):
7: from /Users/seba/.rvm/gems/ruby-2.5.3/bin/ruby_executable_hooks:24:in `<main>'
6: from /Users/seba/.rvm/gems/ruby-2.5.3/bin/ruby_executable_hooks:24:in `eval'
5: from /Users/seba/.rvm/gems/ruby-2.5.3/bin/bundle:23:in `<main>'
4: from /Users/seba/.rvm/gems/ruby-2.5.3/bin/bundle:23:in `load'
3: from /Users/seba/.rvm/gems/ruby-2.5.3/gems/bundler-0.9.26/bin/bundle:13:in `<top (required)>'
2: from /Users/seba/.rvm/gems/ruby-2.5.3/gems/bundler-0.9.26/lib/bundler/vendor/thor.rb:124:in `start'
1: from /Users/seba/.rvm/gems/ruby-2.5.3/gems/bundler-0.9.26/lib/bundler/vendor/thor/base.rb:377:in `start'
/Users/seba/.rvm/gems/ruby-2.5.3/gems/bundler-0.9.26/lib/bundler/vendor/thor/shell.rb:10:in `shell': uninitialized constant Thor::Base::Config (NameError)
and if i try with:
taller_integracion git:(develop) bundler install
Traceback (most recent call last):
10: from /Users/seba/.rvm/gems/ruby-2.5.3/bin/ruby_executable_hooks:10:in `<main>'
9: from /Users/seba/.rvm/rubies/ruby-2.5.3/lib/ruby/gems/2.5.0/gems/executable-hooks-1.6.0/lib/executable-hooks/hooks.rb:49:in `run'
8: from /Users/seba/.rvm/rubies/ruby-2.5.3/lib/ruby/gems/2.5.0/gems/executable-hooks-1.6.0/lib/executable-hooks/hooks.rb:49:in `each'
7: from /Users/seba/.rvm/rubies/ruby-2.5.3/lib/ruby/gems/2.5.0/gems/executable-hooks-1.6.0/lib/executable-hooks/hooks.rb:50:in `block in run'
6: from /Users/seba/.rvm/gems/ruby-2.5.3#global/gems/rubygems-bundler-1.4.5/lib/rubygems_executable_plugin.rb:4:in `block in <top (required)>'
5: from /Users/seba/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:39:in `require'
4: from /Users/seba/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
3: from /Users/seba/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `require'
2: from /Users/seba/.rvm/rubies/ruby-2.5.3/lib/ruby/gems/2.5.0/gems/rubygems-bundler-1.4.5/lib/rubygems-bundler/noexec.rb:131:in `<top (required)>'
1: from /Users/seba/.rvm/rubies/ruby-2.5.3/lib/ruby/gems/2.5.0/gems/rubygems-bundler-1.4.5/lib/rubygems-bundler/noexec.rb:124:in `check'
/Users/seba/.rvm/rubies/ruby-2.5.3/lib/ruby/gems/2.5.0/gems/rubygems-bundler-1.4.5/lib/rubygems-bundler/noexec.rb:84:in `setup': undefined method `rubygems' for Bundler:Module (NoMethodError)
I faced this problem. I was working on a small project hence I just updated ruby version in gemfile to 2.6.3 and it worked for me.
create a new gemset with this ruby version and then run
gem install bundler
to install bundler with the latest ruby.
Now run
bundle install
if bundle install does not work then try
bundle update
this should do the trick.
If you are still facing the same issue then let me know.

rails 5, rbenv - rails console doesn't start - Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib (LoadError)

When I run "rails c" command in terminal, somehow it doesn't start rails console and throws the error. I am running rails 5.2.2 with rbenv.
rails c
It throws the following error.
Running via Spring preloader in process 13912
Traceback (most recent call last):
50: from -e:1:in `<main>'
49: from /Users/wemteq/.rbenv/versions/2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
48: from /Users/wemteq/.rbenv/versions/2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
47: from /Users/wemteq/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:285:in `load'
...
7: from /Users/wemteq/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `require'
6: from /Users/wemteq/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in `load_dependency'
5: from /Users/wemteq/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `block in require'
4: from /Users/wemteq/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
3: from /Users/wemteq/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
2: from /Users/wemteq/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
1: from /Users/wemteq/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
/Users/wemteq/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require': dlopen(/Users/wemteq/.rbenv/versions/2.5.0/lib/ruby/2.5.0/x86_64-darwin17/readline.bundle, 9): Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib (LoadError)
Referenced from: /Users/wemteq/.rbenv/versions/2.5.0/lib/ruby/2.5.0/x86_64-darwin17/readline.bundle
Reason: image not found - /Users/wemteq/.rbenv/versions/2.5.0/lib/ruby/2.5.0/x86_64-darwin17/readline.bundle
It worked a week ago, but not working now. Any ideas?
I found 2 solutions from some researching.
Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib (LoadError)
libreadline.7.dylib is missing, so linking libreadline.8.0.dylib to libreadline.7.dylib worked for me.
ln -s /usr/local/opt/readline/lib/libreadline.8.0.dylib /usr/local/opt/readline/lib/libreadline.7.dylib
libreadline version might be different. You can browse available files in /usr/local/opt/readline/lib/ directory.
rb-readline gem in development group would fix this problem.
gem 'rb-readline'

cannot load such file == rails/cli error when running rails server

Traceback (most recent call last):
5: from C:/Ruby25-x64/bin/rails:23:in `<main>'
4: from C:/Ruby25-x64/bin/rails:23:in `load'
3: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/railties-5.2.2.1/exe/rails:10:in `<top (required)>'
2: from C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:34:in `require'
1: from C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:130:in `rescue in require'
C:/Ruby25-x64/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:130:in `require': cannot load such file -- rails/cli (LoadError)
I am not so sure what caused this error. Prior to this I ran into an error regarding railties and what I did was to
gem uninstall railties
gem install railties
I tried bundle install and this didn't change anything. However I bundle exec rails s

I cannot execute rails console

I am getting an error I have no clue how to fix it.
$ rails console
/Users/liviu-mac/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- bundler/setup (LoadError)
from /Users/liviu-mac/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/liviu-mac/rails_projects/instrumon/vendor/bundle/gems/spring-1.6.1/lib/spring/commands.rb:33:in `<module:Spring>'
from /Users/liviu-mac/rails_projects/instrumon/vendor/bundle/gems/spring-1.6.1/lib/spring/commands.rb:4:in `<top (required)>'
from /Users/liviu-mac/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/liviu-mac/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/liviu-mac/rails_projects/instrumon/vendor/bundle/gems/spring-1.6.1/lib/spring/application.rb:77:in `preload'
from /Users/liviu-mac/rails_projects/instrumon/vendor/bundle/gems/spring-1.6.1/lib/spring/application.rb:143:in `serve'
from /Users/liviu-mac/rails_projects/instrumon/vendor/bundle/gems/spring-1.6.1/lib/spring/application.rb:131:in `block in run'
from /Users/liviu-mac/rails_projects/instrumon/vendor/bundle/gems/spring-1.6.1/lib/spring/application.rb:125:in `loop'
from /Users/liviu-mac/rails_projects/instrumon/vendor/bundle/gems/spring-1.6.1/lib/spring/application.rb:125:in `run'
from /Users/liviu-mac/rails_projects/instrumon/vendor/bundle/gems/spring-1.6.1/lib/spring/application/boot.rb:18:in `<top (required)>'
from /Users/liviu-mac/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/liviu-mac/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from -e:1:in `<main>'
$ ruby -v
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]
$ rails -v
Rails 4.2.5
$ rvm current
ruby-2.2.3
$ irb
2.3.0 :001 >
I am able to start the server with rails s and the app is working. I am able to deploy on Heroku and I can execute rails dbconsole.
Downgraded bundler from 1.11.x to 1.10.2
Removed the folder .bundler from ~ and any main folder of all rails projects (several)
Executed from the main folder of any rails project the command: bundle install --system
Problem solved.

Resources