Agile Web Development with Rails 7: [solved]

Title: Agile Web Development with Rails 7: (page 70)

I am running windows 11 pro with rails 7.0.3 and ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x64-mingw-ucrt]

First problem:
Running rails new depot --css tailwind provides an incomplete install and I get the following error:

Caused by:
TZInfo::DataSources::ZoneinfoDirectoryNotFound: None of the paths included in TZInfo::DataSources::ZoneinfoDataSource.search_path are valid zoneinfo directories.
C:/Users/edbor/Work/depot/config/environment.rb:5:in <main>' Tasks: TOP => app:template => environment (See full trace by running task with --trace) rails turbo:install stimulus:install You must either be running with node (package.json) or importmap-rails (config/importmap.rb) to use this gem. You must either be running with node (package.json) or importmap-rails (config/importmap.rb) to use this gem. rails tailwindcss:install rails aborted! TZInfo::DataSourceNotFound: tzinfo-data is not present. Please add gem 'tzinfo-data' to your Gemfile and run bundle install C:/Users/edbor/Work/depot/config/environment.rb:5:in

Caused by:
TZInfo::DataSources::ZoneinfoDirectoryNotFound: None of the paths included in TZInfo::DataSources::ZoneinfoDataSource.search_path are valid zoneinfo directories.
C:/Users/edbor/Work/depot/config/environment.rb:5:in `’
Tasks: TOP => app:template => environment
(See full trace by running task with --trace)

I have manually deleted ", platforms: %i[ mingw mswin x64_mingw jruby ] " from the manually installed gem file TZinfo-data in Depot to get it to run.
Then running:
C:\depot>rails generate scaffold Product title:string description:text image_url:string price:decimal
invoke active_record
create db/migrate/20220608005427_create_products.rb
create app/models/product.rb
invoke test_unit
create test/models/product_test.rb
create test/fixtures/products.yml
invoke resource_route
route resources :products
invoke scaffold_controller
create app/controllers/products_controller.rb
invoke tailwindcss
create app/views/products
create app/views/products/index.html.erb
create app/views/products/edit.html.erb
create app/views/products/show.html.erb
create app/views/products/new.html.erb
create app/views/products/_form.html.erb
create app/views/products/_product.html.erb
invoke resource_route
invoke test_unit
create test/controllers/products_controller_test.rb
create test/system/products_test.rb
invoke helper
create app/helpers/products_helper.rb
invoke test_unit
invoke jbuilder
create app/views/products/index.json.jbuilder
create app/views/products/show.json.jbuilder
create app/views/products/_product.json.jbuilder

I went to the migrate file and added: “, precision: 8, scale: 2” and the migrated the file with rails db:migrate.

I get to the following step:
“Windows users will need to run the command ruby bin/dev.”

Running ruby bin/dev provide the following error “ruby: no Ruby script found in input (LoadError)” There is no “dev” file in the bin folder. I know this has to be a simple error. Any help is appreciated.
Procfile.dev is there. Running Rails server and going to local host brings up riding the rails logo. Bring up the new product page show the product but it does not match the book. I think tailwind css is not in play. Any thoughts?

Thanks!

Ed

Wow. I admire your perseverance. I encourage you to try WSL2. But to answer your question:

Your rails new did not complete. After it creates a bunch of files, it does a bundle install. After making a few changes, you managed to get past this point. The next steps it normally performs for you, but you can run yourself:

  • bundle binstubs bundler
  • bin/rails importmap:install
  • bin/rails turbo:install stimulus:install
  • bin/rails tailwindcss:install