Home > OS >  Error encountered when running rails new command
Error encountered when running rails new command

Time:03-02

I want to start learning Ruby on Rails. I have installed ruby 2.7.0 via RVM. SQLite3 is also installed by default in ubuntu 20.04.3 LTS. My rails version is 7.0.2.2. When I run the command:

rails new blog

from this guide: https://guides.rubyonrails.org/getting_started.html

It throws an error:

lou@lou-VirtualBox:~$ rails new blog
      create  
      create  README.md
      create  Rakefile
      create  .ruby-version
      create  config.ru
      create  .gitignore
      create  .gitattributes
      create  Gemfile
         run  git init from "."
Traceback (most recent call last):
    27: from /home/lou/.rvm/gems/ruby-2.7.0/bin/ruby_executable_hooks:24:in `<main>'
    26: from /home/lou/.rvm/gems/ruby-2.7.0/bin/ruby_executable_hooks:24:in `eval'
    25: from /home/lou/.rvm/gems/ruby-2.7.0/bin/rails:23:in `<main>'
    24: from /home/lou/.rvm/gems/ruby-2.7.0/bin/rails:23:in `load'
    23: from /home/lou/.rvm/gems/ruby-2.7.0/gems/railties-7.0.2.2/exe/rails:10:in `<top (required)>'
    22: from /home/lou/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
    21: from /home/lou/.rvm/rubies/ruby-2.7.0/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
    20: from /home/lou/.rvm/gems/ruby-2.7.0/gems/railties-7.0.2.2/lib/rails/cli.rb:18:in `<top (required)>'
    19: from /home/lou/.rvm/gems/ruby-2.7.0/gems/railties-7.0.2.2/lib/rails/command.rb:48:in `invoke'
    18: from /home/lou/.rvm/gems/ruby-2.7.0/gems/railties-7.0.2.2/lib/rails/command/base.rb:87:in `perform'
    17: from /home/lou/.rvm/gems/ruby-2.7.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
    16: from /home/lou/.rvm/gems/ruby-2.7.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
    15: from /home/lou/.rvm/gems/ruby-2.7.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
    14: from /home/lou/.rvm/gems/ruby-2.7.0/gems/railties-7.0.2.2/lib/rails/commands/application/application_command.rb:26:in `perform'
    13: from /home/lou/.rvm/gems/ruby-2.7.0/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
    12: from /home/lou/.rvm/gems/ruby-2.7.0/gems/thor-1.2.1/lib/thor/group.rb:232:in `dispatch'
    11: from /home/lou/.rvm/gems/ruby-2.7.0/gems/thor-1.2.1/lib/thor/invocation.rb:134:in `invoke_all'
    10: from /home/lou/.rvm/gems/ruby-2.7.0/gems/thor-1.2.1/lib/thor/invocation.rb:134:in `map'
     9: from /home/lou/.rvm/gems/ruby-2.7.0/gems/thor-1.2.1/lib/thor/invocation.rb:134:in `each'
     8: from /home/lou/.rvm/gems/ruby-2.7.0/gems/thor-1.2.1/lib/thor/invocation.rb:134:in `block in invoke_all'
     7: from /home/lou/.rvm/gems/ruby-2.7.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
     6: from /home/lou/.rvm/gems/ruby-2.7.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
     5: from /home/lou/.rvm/gems/ruby-2.7.0/gems/railties-7.0.2.2/lib/rails/generators/rails/app/app_generator.rb:328:in `create_root_files'
     4: from /home/lou/.rvm/gems/ruby-2.7.0/gems/railties-7.0.2.2/lib/rails/generators/app_base.rb:134:in `build'
     3: from /home/lou/.rvm/gems/ruby-2.7.0/gems/railties-7.0.2.2/lib/rails/generators/app_base.rb:134:in `public_send'
     2: from /home/lou/.rvm/gems/ruby-2.7.0/gems/railties-7.0.2.2/lib/rails/generators/rails/app/app_generator.rb:76:in `version_control'
     1: from /home/lou/.rvm/gems/ruby-2.7.0/gems/railties-7.0.2.2/lib/rails/generators/rails/app/app_generator.rb:258:in `user_default_branch'
/home/lou/.rvm/gems/ruby-2.7.0/gems/railties-7.0.2.2/lib/rails/generators/rails/app/app_generator.rb:258:in ``': No such file or directory - git (Errno::ENOENT)

I can't find issue related to mine, so I hope someone could help me out.

CodePudding user response:

I solved my problem. It looks like it also needs git installed.

  • Related