Search code examples
rubytailwind-cssruby-on-rails-7.2

'rails new --css tailwind' Does not create either bin/dev or Procfile.dev in rails app


in short, creating an new rails with tailwind css in my linux terminal (e.g.):

~$ rails new depot --css tailwind --database=postqresql

does not create the necessary files to run the following command:

~/depot$ bin/dev

which when trying to run it at the mean time returns the error below:

bash: bin/dev: No such file or directory

i tried looking for this issue in coding communities, but to no avail

(please bear with me , i'm a newbie at this domain)


Solution

  • I was working on this same problem this past week. Running Rails 7.2.1 Here are the steps I went through. Since you mentioned you are a newbie at this domain I'm making no assumptions.

    Your local environment needs to have Postgres installed and the user setup beforehand.

    1. Tailwind wasn't installed to my app even though I declared it as a an option/variable when creating the app. So I installed it again. - Install Tailwind on Rails

    2. Set the Postgres gem to 1.5.7 in Gemfile as it was failing during installation

      gem "pg", "1.5.7"
      
    3. Run bundle install to install gems

    4. Create .env in root directory and add database credentials to .env

      POSTGRES_DEV_PASSWORD=yourpasswordhere
      
    5. Add database env variables to config/database.yml.

      development:
            <<: *default
            database: postgres_development_database
            username: your_postgres_username
            password: <%= ENV["POSTGRES_DEV_PASSWORD"] %>
            host: '127.0.0.1'
      
    6. Run database migrations. bin/rails db:migrate