Bird
0
0

You tried to install a gem using gem install sinatra but got an error saying command not found: gem. What is the most likely cause?

medium📝 Debug Q14 of 15
Ruby - Gems and Bundler
You tried to install a gem using gem install sinatra but got an error saying command not found: gem. What is the most likely cause?
AThe gem name 'sinatra' is misspelled.
BThe gem is already installed, so it cannot be installed again.
CYou need to use <code>ruby gem install sinatra</code> instead.
DYou ran the command inside Ruby code instead of the terminal.
Step-by-Step Solution
Solution:
  1. Step 1: Understand the error message

    The error command not found: gem means the system does not recognize the gem command where it was run.
  2. Step 2: Identify correct usage context

    gem install must be run in the terminal (command line), not inside Ruby code or IRB.
  3. Final Answer:

    You ran the command inside Ruby code instead of the terminal. -> Option D
  4. Quick Check:

    Run gem commands in terminal, not Ruby code [OK]
Quick Trick: Run gem commands in terminal, not inside Ruby scripts [OK]
Common Mistakes:
  • Trying to run gem install inside Ruby code
  • Adding 'ruby' before gem install command
  • Assuming gem install fails if gem exists

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes