'Error while creating project on ruby on rails

I am new to ruby on rails hence when i am trying to create new project by following command: rails new abc I am getting following error

rails aborted! Psych::BadAlias: Unknown alias: default /home/iftikhar/Desktop/abc/bin/rails:9:in <top (required)>' /home/iftikhar/Desktop/abc/bin/spring:15:in require' /home/iftikhar/Desktop/abc/bin/spring:15:in <top (required)>' ./bin/rails:3:in load' ./bin/rails:3:in `' Tasks: TOP => app:template (See full trace by running task with --trace)



Solution 1:[1]

According to this page Rails 6.0 is not compatible with Ruby 3.1. This makes sense because Ruby 3.1 was released just a couple of days ago but Rails 6.0.4.4 was released more than a year ago and was the last release of Rails 6.0 since then. Furthermore, it is worth noting that Rails 6.0 is not actively maintained anymore.

I suggest using the latest Ruby on Rails (7.0.1) version when you want to start a new project. Or if you really need to work with Rails 6.0 (what I would not recommend) then you will need to downgrade Ruby to 2.7.5

Solution 2:[2]

Within config/database.yml rename default: to x-default:.

https://stackoverflow.com/a/71944400/2675670

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 spickermann
Solution 2 Richard