title: Error getting a simple example to work in Rails / Turbo / Hotwire
body: <p>I am learning Hotwire-rails, following both the gorails.com and the Hotwire.dev examples. I am running Ruby 3.0.2 and Rails 6.1.4.1. The symptom is at the very start. After rails new xxx, I edit Gemfile to add gem 'hotwire-rails', then bundle install. At this point my app/javascript/packs/application.js is now:</p>
  <pre><code>cat app/javascript/packs/application.js 
  // This file is automatically compiled by Webpack, along with any other files
  // present in this directory. You're encouraged to place your actual application logic in
  // a relevant structure within app/javascript and only use these pack files to reference
  // that code so it'll be compiled.
  
  import Rails from &quot;@rails/ujs&quot;
  import Turbolinks from &quot;turbolinks&quot;
  import * as ActiveStorage from &quot;@rails/activestorage&quot;
  import &quot;channels&quot;
  
  Rails.start()
  Turbolinks.start()
  ActiveStorage.start()
  </code></pre>
  <p>So that looks ok. But then rails Hotwire:install. Here is what I see (with the error messages in red.) It is as if it can't find the file.</p>
  <pre><code>/mydev/public_samples/rails/hotwire_error (master) rails hotwire:install
  Create controllers directory
        create  app/javascript/controllers
        create  app/javascript/controllers/index.js
        create  app/javascript/controllers/application.js
        create  app/javascript/controllers/hello_controller.js
  You must import &quot;./controllers&quot; in your JavaScript entrypoint
  Install Stimulus
           run  yarn add @hotwired/stimulus from &quot;.&quot;
  yarn add v1.22.10
  [1/4]   Resolving packages...
  [2/4]   Fetching packages...
  [3/4]   Linking dependencies...
  [4/4]   Building fresh packages...
  success Saved lockfile.
  success Saved 1 new dependency.
  info Direct dependencies
  └─ @hotwired/stimulus@3.0.1
  info All dependencies
  └─ @hotwired/stimulus@3.0.1
  ✨  Done in 3.00s.
  You must import @hotwired/turbo-rails in your JavaScript entrypoint file
  Install Turbo
           run  yarn add @hotwired/turbo-rails from &quot;.&quot;
  yarn add v1.22.10
  [1/4]   Resolving packages...
  [2/4]   Fetching packages...
  [3/4]   Linking dependencies...
  [4/4]   Building fresh packages...
  success Saved lockfile.
  success Saved 2 new dependencies.
  info Direct dependencies
  └─ @hotwired/turbo-rails@7.0.1
  info All dependencies
  ├─ @hotwired/turbo-rails@7.0.1
  └─ @hotwired/turbo@7.0.1
  ✨  Done in 3.73s.
  Enable redis in bundle
          gsub  Gemfile
           run  bundle install
  Fetching gem metadata from https://rubygems.org/............
  Resolving dependencies...
  Using rake 13.0.6
  Using concurrent-ruby 1.1.9
  Using minitest 5.14.4
  Using zeitwerk 2.5.1
  Using builder 3.2.4
  Using erubi 1.10.0
  Using racc 1.6.0
  Using crass 1.0.6
  Using rack 2.2.3
  Using nio4r 2.5.8
  Using websocket-extensions 0.1.5
  Using marcel 1.0.2
  Using mini_mime 1.1.2
  Using public_suffix 4.0.6
  Using bindex 0.8.1
  Using msgpack 1.4.2
  Using bundler 2.2.23
  Using byebug 11.1.3
  Using matrix 0.4.2
  Using regexp_parser 2.1.1
  Using childprocess 4.1.0
  Using ffi 1.15.4
  Using method_source 1.0.0
  Using thor 1.1.0
  Using rb-fsevent 0.11.0
  Using redis 4.5.1
  Using rexml 3.2.5
  Using rubyzip 2.3.2
  Using tilt 2.0.10
  Using semantic_range 3.0.0
  Using spring 3.0.0
  Using sqlite3 1.4.2
  Using turbolinks-source 5.2.0
  Using i18n 1.8.11
  Using tzinfo 2.0.4
  Using nokogiri 1.12.5 (x86_64-darwin)
  Using rack-test 1.1.0
  Using websocket-driver 0.7.5
  Using mail 2.7.1
  Using addressable 2.8.0
  Using bootsnap 1.9.1
  Using sprockets 4.0.2
  Using rb-inotify 0.10.1
  Using puma 5.5.2
  Using rack-mini-profiler 2.3.3
  Using rack-proxy 0.7.0
  Using sassc 2.4.0
  Using selenium-webdriver 4.0.3
  Using turbolinks 5.2.1
  Using activesupport 6.1.4.1
  Using loofah 2.12.0
  Using xpath 3.2.0
  Using listen 3.7.0
  Using webdrivers 5.0.0
  Using rails-dom-testing 2.0.3
  Using rails-html-sanitizer 1.4.2
  Using globalid 0.5.2
  Using activemodel 6.1.4.1
  Using capybara 3.36.0
  Using jbuilder 2.11.2
  Using actionview 6.1.4.1
  Using activejob 6.1.4.1
  Using activerecord 6.1.4.1
  Using actionpack 6.1.4.1
  Using actioncable 6.1.4.1
  Using activestorage 6.1.4.1
  Using actionmailer 6.1.4.1
  Using railties 6.1.4.1
  Using sprockets-rails 3.2.2
  Using actionmailbox 6.1.4.1
  Using actiontext 6.1.4.1
  Using sassc-rails 2.1.2
  Using web-console 4.1.0
  Using webpacker 5.4.3
  Using rails 6.1.4.1
  Using sass-rails 6.0.0
  Using turbo-rails 0.8.3
  Using stimulus-rails 0.7.2
  Using hotwire-rails 0.1.3
  Bundle complete! 19 Gemfile dependencies, 79 gems now installed.
  Use `bundle info [gemname]` to see where a bundled gem is installed.
  Switch development cable to use redis
          gsub  config/cable.yml
  </code></pre>
  <p>Notice in particular the two errors: You must import &quot;./controllers&quot; in your JavaScript entrypoint and You must import @hotwired/turbo-rails in your JavaScript entrypoint file</p>
  <p>Looking at the <a href="https://github.com/hotwired/stimulus-rails/blob/main/lib/install/stimulus_with_node.rb#L14" rel="nofollow noreferrer">stimulus source code</a>, it looks like a different file is being checked:</p>
  <pre><code>if (Rails.root.join(&quot;app/javascript/application.js&quot;)).exist?
  </code></pre>
  <p>So that's inconsistent with what I thought I needed to do.</p>
  <p>Now I assumed these were innocuous but I am having a little trouble getting the example to work so before going crazy debugging that I wanted to chase down those error messages. Nobody else seems to be getting them. Is it a newly introduced bug or something?</p>