1

I'm having an issue while installing wp-scan, expecially with the command:

sudo gem install bundler && bundle install --without test

which returns:

WARNING:  You don't have /root/.gem/ruby/2.3.0/bin in your PATH, 
  gem executables will not run.
 Successfully installed bundler-1.12.4
 Parsing documentation for bundler-1.12.4
 Done installing documentation for bundler after 5 seconds
 1 gem installed
 bash: bundle: command not found

I searched and it seems I didn't set the Ruby path, but when I try to set it using "Setup", bash returns:

-e:1: unexpected fraction part after numeric literal
/root/.gem/ruby/2.3.0/
                  ^

This is the .bashrc file:

#
# ~/.bashrc
#

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

alias ls='ls --color=auto'
PS1='[\u@\h \W]\$ '
# >>>>BEGIN ADDED BY CNCHI INSTALLER<<<< #
BROWSER=/usr/bin/chromium
EDITOR=/usr/bin/nano
# >>>>>END ADDED BY CNCHI INSTALLER<<<<< #

#la riga inferiore serve a creare il path corretto di gem /ruby
PATH="$(ruby -e '/root/.gem/ruby/2.3.0/')/bin:$PATH"

What am I doing wrong?

Here is the gem env return:

RubyGems Environment: - RUBYGEMS VERSION: 2.5.1 - RUBY VERSION: 2.3.1 (2016-04-26 patchlevel 112) [x86_64-linux] - INSTALLATION DIRECTORY: /usr/lib/ruby/gems/2.3.0 - USER INSTALLATION DIRECTORY: /home/thecave3/.gem/ruby/2.3.0 - RUBY EXECUTABLE: /usr/bin/ruby - EXECUTABLE DIRECTORY: /usr/bin - SPEC CACHE DIRECTORY: /home/thecave3/.gem/specs - SYSTEM CONFIGURATION DIRECTORY: /etc - RUBYGEMS PLATFORMS: - ruby - x86_64-linux - GEM PATHS: - /usr/lib/ruby/gems/2.3.0 - /home/thecave3/.gem/ruby/2.3.0 - GEM CONFIGURATION: - :update_sources => true - :verbose => true - :backtrace => false - :bulk_threshold => 1000 - "gem" => "--user-install" - REMOTE SOURCES: - https://rubygems.org/ - SHELL PATH: - /usr/local/sbin - /usr/local/bin - /usr/bin - /usr/bin/site_perl - /usr/bin/vendor_perl - /usr/bin/core_perl - /root/.gem/ruby/2.3.0/bin

1
  • Please add the output of gem env to your question, formatted appropriately. Generally we don't need to add the path to Ruby as the binary is in the existing path, unless you installed it from source which put it into /usr/local/bin or a special prefix, or you used a sandbox. And, since you didn't say which sandbox we have to assume it's a standard install. Commented May 24, 2016 at 0:19

1 Answer 1

4

Adding the following to your .bashrc should do the trick:

export PATH="$PATH:/root/.gem/ruby/2.3.0/bin"

$(..) is a command substitution and it a way to capture the output from a command:

a=$(echo 1234)

will assign the value 1234 to a, of course, the same can be achieved with a=1234.

ruby -e '...'

will evaluate the code passed after -e, in your case /root/.gem/ruby/2.3.0/ which is not valid Ruby code, but a path to find executables.

I also added the Ruby path to the end of the PATH variable. This is considered the best approach since the shell will search though it to find the desired program. Consider this:

~/bin % export PATH="$HOME/bin:/bin:/usr/bin" 
~/bin % cat grep
#!/bin/sh
echo "got ya"
~/bin % grep '...' '...'
got ya
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.