/usr/bin/jekyll: No such file or directory - ruby

I am having troubles with jekyll. I have Ubuntu 14.04. I've tried to deploy a static site with rack-jekyll and I ended up messing up with my ruby and jekyll installation files.
I've already made ruby work just fine (I used rbenv to install version 2.2.3) but I still have problems with jekyll. When I type jekyll new smth or jekyll serve it shows:
bash: /usr/bin/jekyll: No such file or directory
I have already installed jekyll but it still shows that. From what I searched it might be a problem with some path.
Here are some information that might help to find a solution:
rafael#rafael-K56CM:~$ which jekyll
/home/rafael/.rbenv/shims/jekyll
rafael#rafael-K56CM:~$ sudo find / -name jekyll
[sudo] password for rafael:
/home/rafael/.rbenv/shims/jekyll
/home/rafael/.rbenv/versions/2.2.3/bin/jekyll
/home/rafael/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-2.5.3/bin/jekyll
/home/rafael/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-2.5.3/lib/jekyll
/home/rafael/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-coffeescript-1.0.1/lib/jekyll
/home/rafael/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-sass-converter-1.3.0/lib/jekyll
/home/rafael/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/jekyll-watch-1.2.1/lib/jekyll
rafael#rafael-K56CM:~$ gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.8
- RUBY VERSION: 2.2.3 (2015-08-18 patchlevel 173) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/rafael/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0
- RUBY EXECUTABLE: /home/rafael/.rbenv/versions/2.2.3/bin/ruby
- EXECUTABLE DIRECTORY: /home/rafael/.rbenv/versions/2.2.3/bin
- SPEC CACHE DIRECTORY: /home/rafael/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /home/rafael/.rbenv/versions/2.2.3/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/rafael/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0
- /home/rafael/.gem/ruby/2.2.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["https://rubygems.org/", "http://rubygems.org/"]
- "gem" => "--no-ri --no-rdoc"
- REMOTE SOURCES:
- https://rubygems.org/
- http://rubygems.org/
- SHELL PATH:
- /home/rafael/.rbenv/versions/2.2.3/bin
- /usr/lib/rbenv/libexec
- /home/rafael/.rbenv/shims
- /home/rafael/.rbenv/bin
- /home/rafael/.rbenv/shims
- /home/rafael/.rbenv/bin
- /usr/local/heroku/bin
- /home/rafael/.rbenv/plugins/ruby-build/bin
- /home/rafael/.rbenv/shims
- /home/rafael/.rbenv/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
- /usr/local/games
- /home/rafael/.rvm/bin
- /home/rafael/.rvm/bin

This issue can be solved by creating a symbolic link to the jekyll executable:
sudo ln -s /path/to/project/gems/bin/jekyll /usr/bin/jekyll
Use the which command to identify where the jekyll executable is installed.

Related

How do I reset Ruby and RubyGems / Path Variable? I have installed multiple versions while trying to fix and issue with Jekyll and Bundler

I am running macOS Catalina 10.15.3 and cannot execute Jekyll commands. I suspect it's the result of too many versions of Ruby / RubyGems installed and the conflicting paths I have created haphazardly, I'm pretty sure my path variable is completely messed up:
echo $PATH returns
/usr/local/opt/ruby/bin:/usr/local/opt/ruby/bin:/usr/local/opt/ruby/bin:/usr/local/opt/ruby/bin:/usr/local/opt/ruby/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:export
Here are the jekyll-related issues:
I receive -bash: jekyll: command not found when trying jekyll serve and when running bundle exec jekyll serve it returns Could not locate Gemfile or .bundle/ directory.
I think another issue compounding this is that I installed jekyll globally when trying to update it. I notice that it pops up with all of its dependancies when running gem list
For reference - check out what I get when I run gem env:
RubyGems Environment:
- RUBYGEMS VERSION: 3.1.2
- RUBY VERSION: 2.7.0 (2019-12-25 patchlevel 0) [x86_64-darwin19]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.7.0
- USER INSTALLATION DIRECTORY: /Users/will/.gem/ruby/2.7.0
- RUBY EXECUTABLE: /usr/local/opt/ruby/bin/ruby
- GIT EXECUTABLE: /usr/bin/git
- EXECUTABLE DIRECTORY: /usr/local/lib/ruby/gems/2.7.0/bin
- SPEC CACHE DIRECTORY: /Users/will/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /usr/local/Cellar/ruby/2.7.0/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-19
- GEM PATHS:
- /usr/local/lib/ruby/gems/2.7.0
- /Users/will/.gem/ruby/2.7.0
- /usr/local/Cellar/ruby/2.7.0/lib/ruby/gems/2.7.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/opt/ruby/bin
- /usr/local/opt/ruby/bin
- /usr/local/opt/ruby/bin
- /usr/local/opt/ruby/bin
- /usr/local/opt/ruby/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- export
Please help me get my system back to square one. I'm way in over my head and just want a do over.
My recommendation is to clear all those ruby paths from your PATH, remove every version of Ruby that you have installed and begin again with https://github.com/rbenv/rbenv
Install whatever versions of Ruby you need, and then use bundler to manage your gems https://jekyllrb.com/tutorials/using-jekyll-with-bundler/
Invoke jekyll using bundle exec jekyll and you should be back in business.

How to install and run "hanami new bookshelf" from zsh

I installed the Hanami gem and ran hanami new bookshelf but got
zsh: command not found: hanami
I'm running:
macos 10.15.1
homebrew: 2.1.16
ruby: 2.6.5p114
rubygem: 3.0.6
hanami: 1.3.3
Does anyone know how to resolve this?
Same issue here; with a fresh installed MacOS Sierra, ruby & etc.
gem env output:
RubyGems Environment:
- RUBYGEMS VERSION: 3.0.6
- RUBY VERSION: 2.6.5 (2019-10-01 patchlevel 114) [x86_64-darwin16]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.6.0
- USER INSTALLATION DIRECTORY: /Users/captainhusaynpenguin/.gem/ruby/2.6.0
- RUBY EXECUTABLE: /usr/local/opt/ruby/bin/ruby
- GIT EXECUTABLE: /usr/local/bin/git
- EXECUTABLE DIRECTORY: /usr/local/lib/ruby/gems/2.6.0/bin
- SPEC CACHE DIRECTORY: /Users/captainhusaynpenguin/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /usr/local/Cellar/ruby/2.6.5/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-16
- GEM PATHS:
- /usr/local/lib/ruby/gems/2.6.0
- /Users/captainhusaynpenguin/.gem/ruby/2.6.0
- /usr/local/Cellar/ruby/2.6.5/lib/ruby/gems/2.6.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/opt/ruby/bin
- /usr/local/opt/ruby/bin
- /usr/local/opt/ruby/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
and finally, with the answer to a similar question by rubiii:
adding the EXECUTABLE DIRECTORY to PATH was the solution.
Quick command from above example:
export PATH=$PATH:/usr/local/lib/ruby/gems/2.6.0/bin
For permanently adding it to path:
sudo nano /etc/paths
was the fix.

Rubygems: You do not have permission to push to this gem

I have developed a gem called web_scraper. When I am trying to publish it to rubygems.org I am getting below issue.
> You do not have permission to push to this gem. Ask an owner to add
> you with: gem owner web_scraper --add <email>
Here is the output of gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.5.1
- RUBY VERSION: 2.3.1 (2016-04-26 patchlevel 112) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/bhaskar/.rvm/gems/ruby-2.3.1
- USER INSTALLATION DIRECTORY: /home/bhaskar/.gem/ruby/2.3.0
- RUBY EXECUTABLE: /home/bhaskar/.rvm/rubies/ruby-2.3.1/bin/ruby
- EXECUTABLE DIRECTORY: /home/bhaskar/.rvm/gems/ruby-2.3.1/bin
- SPEC CACHE DIRECTORY: /home/bhaskar/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/bhaskar/.rvm/gems/ruby-2.3.1
- /home/bhaskar/.rvm/gems/ruby-2.3.1#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /home/bhaskar/.rvm/gems/ruby-2.3.1/bin
- /home/bhaskar/.rvm/gems/ruby-2.3.1#global/bin
- /home/bhaskar/.rvm/rubies/ruby-2.3.1/bin
- /home/bhaskar/.rvm/bin
- /home/bhaskar/.nvm/versions/node/v6.9.3/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
- /usr/local/games
- /snap/bin
I have proper rubygems account and API key also available.
How to resolve this issue?
Your gem name needs to be unused on RubyGems, you can use the search on https://rubygems.org/ to check whether the gem exists, in this case, it does, so you'll need to rename your gem to use a name that isn't in use.
The answer is right there in the message:
You do not have permission to push to this gem. Ask an owner to add
you with: gem owner web_scraper --add <email>
You need to ask the owner of the web_scraper gem to add you as a developer to allow you to make updates to the gem.

Running a script from gem in GitHub in RVM

Can anyone help me walk through what I'm doing wrong here? This is my first go w/ Ruby so any help would be appreciated:
I've installed RVM and executing it through Terminal
I'm trying to run the script detailed in this post from GitHub:
https://github.com/michiels/helpscout-export
I was successfully able to install the gem 'HelpScout'
When I run ruby export.rb MY_api_key I get this error message:
ruby: No such file or directory -- export.rb (LoadError)
Anyone have any insight? Here's my current gem environment:
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.8
- RUBY VERSION: 2.0.0 (2013-11-22 patchlevel 353) [x86_64-darwin15.0.0]
- INSTALLATION DIRECTORY: /Users/stevekrause/.rvm/gems/ruby-2.0.0-p353
- RUBY EXECUTABLE: /Users/stevekrause/.rvm/rubies/ruby-2.0.0-p353/bin/ruby
- EXECUTABLE DIRECTORY: /Users/stevekrause/.rvm/gems/ruby-2.0.0-p353/bin
- SPEC CACHE DIRECTORY: /Users/stevekrause/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/stevekrause/.rvm/rubies/ruby-2.0.0-p353/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-15
- GEM PATHS:
- /Users/stevekrause/.rvm/gems/ruby-2.0.0-p353
- /Users/stevekrause/.rvm/gems/ruby-2.0.0-p353#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/stevekrause/.rvm/gems/ruby-2.0.0-p353/bin
- /Users/stevekrause/.rvm/gems/ruby-2.0.0-p353#global/bin
- /Users/stevekrause/.rvm/rubies/ruby-2.0.0-p353/bin
- /Users/stevekrause/.rvm/bin
- /Library/Frameworks/Python.framework/Versions/3.5/bin
- /Users/stevekrause/anaconda/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin

bundle install hangs inexplicably

I am on RHEL 6, and have built Ruby from source and installed into /usr/local.
The server I am on does not have outside internet access, EXCEPT to access Rubygems.org. That is the only outside connection it is permitted to make. This is a corporate security restriction and there is nothing I can do, so please don't say 'use rvm'. I would if I could...
I need to run bundle install as a certain user, ciwasadm. But when I do, the terminal just hangs. When I run bundle install or gem install whatever as my username, wannia1, I am able to connect to Rubygems.org and get wahtever I need.
For some reason, the hanging only occurs when I am sudo'ed into ciwasadm. The Ruby installation for both users is working and I can run ruby files in the command line. I just don't understand why bundler is any different.
Running gem env for ciwasadm returns:
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.8
- RUBY VERSION: 2.0.0 (2015-04-13 patchlevel 645) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.0.0
- RUBY EXECUTABLE: /usr/local/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/bin
- SPEC CACHE DIRECTORY: /home/ciwasadm/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /usr/local/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /usr/local/lib/ruby/gems/2.0.0
- /home/ciwasadm/.gem/ruby/2.0.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/bin
- /sbin
- /bin
- /usr/sbin
- /usr/bin
- /opt/groovy-1.8.3/bin
Running gem env for wannia returns:
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.8
- RUBY VERSION: 2.0.0 (2015-04-13 patchlevel 645) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.0.0
- RUBY EXECUTABLE: /usr/local/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/bin
- SPEC CACHE DIRECTORY: /home/wannia1/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /usr/local/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /usr/local/lib/ruby/gems/2.0.0
- /home/wannia1/.gem/ruby/2.0.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/bin
- /usr/lib64/qt-3.3/bin
- /usr/local/bin
- /bin
- /usr/bin
- /usr/local/sbin
- /usr/sbin
- /sbin
- /opt/groovy-1.8.3/bin
- /home/wannia1/bin
I'll post my solution here with the hopes that it helps someone else in the future.
Bundler was hanging because it could not reach the rubygems.org server. This is because a proxy was required, but had not been set.
I was able to run export http_proxy=<insert proxy info here> in my bash shell, and then was able to dial out.

Resources