Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npx missing when using --js esbuild #22

Open
excid3 opened this issue Jul 16, 2024 · 6 comments
Open

npx missing when using --js esbuild #22

excid3 opened this issue Jul 16, 2024 · 6 comments

Comments

@excid3
Copy link
Contributor

excid3 commented Jul 16, 2024

If you run rails-new main --js esbuild, you'll get the following error because npx is not available.

       rails  javascript:install:esbuild
       apply  /usr/local/bundle/gems/jsbundling-rails-1.3.0/lib/install/esbuild/install.rb
       apply    /usr/local/bundle/gems/jsbundling-rails-1.3.0/lib/install/install.rb
    Compile into app/assets/builds
      create      app/assets/builds
      create      app/assets/builds/.keep
      append      app/assets/config/manifest.js
      append      .gitignore
      append      .gitignore
    Add JavaScript include tag in application layout
      insert      app/views/layouts/application.html.erb
    Create default entrypoint in app/javascript/application.js
      create      app/javascript
      create      app/javascript/application.js
    Add default package.json
      create      package.json
    Add bin/dev to start foreman
      create      bin/dev
       apply    /usr/local/bundle/gems/jsbundling-rails-1.3.0/lib/install/install_procfile.rb
    Add default Procfile.dev
      create      Procfile.dev
    Ensure foreman is installed
         run      gem install foreman from "."
Successfully installed foreman-0.88.1
1 gem installed
  Install esbuild
         run    yarn add esbuild from "."
  Add build script
bin/rails aborted!
Rails::Generators::Error: The template [/usr/local/bundle/gems/jsbundling-rails-1.3.0/lib/install/esbuild/install.rb] could not be loaded. Error: No such file or directory - npx (Rails::Generators::Error)


Caused by:
Errno::ENOENT: No such file or directory - npx (Errno::ENOENT)

Tasks: TOP => app:template
(See full trace by running task with --trace)

Since Node isn't installed in the Docker container, Rails can't add the esbuild package with npx.

I'm not sure if this also applies to --js bun or not.

@betogrun
Copy link

The same issue is happening with --css tailwind.

Bundle complete! 15 Gemfile dependencies, 84 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
       rails  css:install:tailwind
       apply  /usr/local/bundle/gems/cssbundling-rails-1.4.0/lib/install/tailwind/install.rb
       apply    /usr/local/bundle/gems/cssbundling-rails-1.4.0/lib/install/install.rb
    Build into app/assets/builds
       exist      app/assets/builds
   identical      app/assets/builds/.keep
   unchanged      app/assets/config/manifest.js
    Stop linking stylesheets automatically
        gsub      app/assets/config/manifest.js
   unchanged      .gitignore
   unchanged      .gitignore
    Remove app/assets/stylesheets/application.css so build output can take over
      remove      app/assets/stylesheets/application.css
    Add stylesheet link tag in application layout
   unchanged      app/views/layouts/application.html.erb
      append      Procfile.dev
    Add bin/dev to start foreman
   identical      bin/dev
  Install Tailwind (+PostCSS w/ autoprefixer)
      create    tailwind.config.js
      create    app/assets/stylesheets/application.tailwind.css
         run    yarn add tailwindcss@latest postcss@latest autoprefixer@latest from "."
  Add build:css script
bin/rails aborted!
Rails::Generators::Error: The template [/usr/local/bundle/gems/cssbundling-rails-1.4.0/lib/install/tailwind/install.rb] could not be loaded. Error: No such file or directory - npx (Rails::Generators::Error)


Caused by:
Errno::ENOENT: No such file or directory - npx (Errno::ENOENT)

Tasks: TOP => app:template
(See full trace by running task with --trace)

@sultanmyrza
Copy link

Tested on:

  • Apple M1 Pro
  • macOS 14.5

Without --javascript Flag ✅

The scaffolding command works as expected:

./rails-new --rails-version 7.2.0.beta3 \
  rails_playground \
  --css=tailwind \
  --database=postgresql \
  --asset-pipeline=propshaft \
  --devcontainer

With (--javascript=esbuild) ❌

When using the esbuild flag, the command is:

./rails-new --rails-version 7.2.0.beta3 \
  rails_playground \
  --css=tailwind \
  --database=postgresql \
  --asset-pipeline=propshaft \
  --javascript=esbuild \
  --devcontainer

However, it results in the following error:

Caused by:
Errno::ENOENT: No such file or directory - npx (Errno::ENOENT)
see the full error logs
./rails-new --rails-version 7.2.0.beta3 \
rails_playground \
--css=tailwind \
--database=postgresql \
--javascript=esbuild \
--asset-pipeline=propshaft \
--devcontainer
[+] Building 1.6s (7/7) FINISHED                                                                                               docker:desktop-linux
=> [internal] load build definition from Dockerfile                                                                                           0.0s
=> => transferring dockerfile: 307B                                                                                                           0.0s
=> [internal] load metadata for docker.io/library/ruby:3.3.1                                                                                  1.5s
=> [auth] library/ruby:pull token for registry-1.docker.io                                                                                    0.0s
=> [internal] load .dockerignore                                                                                                              0.0s
=> => transferring context: 2B                                                                                                                0.0s
=> [1/2] FROM docker.io/library/ruby:3.3.1@sha256:797d68561a91415e05fd95178f467d86d77bce2d4f17f32683241a687cbd1705                            0.0s
=> CACHED [2/2] RUN if [ -z "7.2.0.beta3" ] ; then gem install rails ; else gem install rails -v 7.2.0.beta3 ; fi                             0.0s
=> exporting to image                                                                                                                         0.0s
=> => exporting layers                                                                                                                        0.0s
=> => writing image sha256:826431269572e80d02f93432a339c5044370632878a2cac89332e181df925c5e                                                   0.0s
=> => naming to docker.io/library/rails-new-3.3.1-7.2.0.beta3                                                                                 0.0s

What's next:
  View a summary of image vulnerabilities and recommendations → docker scout quickview 
    create  
    create  README.md
    create  Rakefile
    create  .node-version
    create  .ruby-version
    create  config.ru
    create  .gitignore
    create  .gitattributes
    create  Gemfile
       run  git init -b main from "."
Initialized empty Git repository in /Users/sultanmyrza/Development/rails-projects/rails_playground/.git/
    create  app
    create  app/assets/config/manifest.js
    create  app/assets/stylesheets/application.css
    create  app/channels/application_cable/channel.rb
    create  app/channels/application_cable/connection.rb
    create  app/controllers/application_controller.rb
    create  app/helpers/application_helper.rb
    create  app/jobs/application_job.rb
    create  app/mailers/application_mailer.rb
    create  app/models/application_record.rb
    create  app/views/layouts/application.html.erb
    create  app/views/layouts/mailer.html.erb
    create  app/views/layouts/mailer.text.erb
    create  app/views/pwa/manifest.json.erb
    create  app/views/pwa/service-worker.js
    create  app/assets/images
    create  app/assets/images/.keep
    create  app/controllers/concerns/.keep
    create  app/models/concerns/.keep
    create  bin
    create  bin/brakeman
    create  bin/rails
    create  bin/rake
    create  bin/rubocop
    create  bin/setup
    create  Dockerfile
    create  .dockerignore
    create  bin/docker-entrypoint
    create  .rubocop.yml
    create  .github/workflows
    create  .github/workflows/ci.yml
    create  .github/dependabot.yml
    create  config
    create  config/routes.rb
    create  config/application.rb
    create  config/environment.rb
    create  config/cable.yml
    create  config/puma.rb
    create  config/storage.yml
    create  config/environments
    create  config/environments/development.rb
    create  config/environments/production.rb
    create  config/environments/test.rb
    create  config/initializers
    create  config/initializers/assets.rb
    create  config/initializers/content_security_policy.rb
    create  config/initializers/cors.rb
    create  config/initializers/filter_parameter_logging.rb
    create  config/initializers/inflections.rb
    create  config/initializers/new_framework_defaults_7_2.rb
    create  config/initializers/permissions_policy.rb
    create  config/locales
    create  config/locales/en.yml
    create  config/master.key
    append  .gitignore
    create  config/boot.rb
    create  config/database.yml
    create  db
    create  db/seeds.rb
    create  lib
    create  lib/tasks
    create  lib/tasks/.keep
    create  lib/assets
    create  lib/assets/.keep
    create  log
    create  log/.keep
    create  public
    create  public/404.html
    create  public/406-unsupported-browser.html
    create  public/422.html
    create  public/500.html
    create  public/icon.png
    create  public/icon.svg
    create  public/robots.txt
    create  tmp
    create  tmp/.keep
    create  tmp/pids
    create  tmp/pids/.keep
    create  vendor
    create  vendor/.keep
    create  test/fixtures/files
    create  test/fixtures/files/.keep
    create  test/controllers
    create  test/controllers/.keep
    create  test/mailers
    create  test/mailers/.keep
    create  test/models
    create  test/models/.keep
    create  test/helpers
    create  test/helpers/.keep
    create  test/integration
    create  test/integration/.keep
    create  test/channels/application_cable/connection_test.rb
    create  test/test_helper.rb
    create  test/system
    create  test/system/.keep
    create  test/application_system_test_case.rb
    create  storage
    create  storage/.keep
    create  tmp/storage
    create  tmp/storage/.keep
    create  .devcontainer
    create  .devcontainer/devcontainer.json
    create  .devcontainer/Dockerfile
    create  .devcontainer/compose.yaml
      gsub  test/application_system_test_case.rb
 identical  config/database.yml
    remove  app/assets/config/manifest.js
    remove  app/assets/config
    remove  app/assets/stylesheets/application.css
    create  app/assets/stylesheets/application.css
    remove  config/initializers/cors.rb
    remove  config/initializers/new_framework_defaults_7_2.rb
       run  bundle install --quiet
       run  bundle lock --add-platform=x86_64-linux
Writing lockfile to /Users/sultanmyrza/Development/rails-projects/rails_playground/Gemfile.lock
       run  bundle binstubs bundler
     rails  javascript:install:esbuild
     apply  /usr/local/bundle/gems/jsbundling-rails-1.3.0/lib/install/esbuild/install.rb
     apply    /usr/local/bundle/gems/jsbundling-rails-1.3.0/lib/install/install.rb
  Compile into app/assets/builds
    create      app/assets/builds
    create      app/assets/builds/.keep
    append      .gitignore
    append      .gitignore
  Add JavaScript include tag in application layout
    insert      app/views/layouts/application.html.erb
  Create default entrypoint in app/javascript/application.js
    create      app/javascript
    create      app/javascript/application.js
  Add default package.json
    create      package.json
  Add bin/dev to start foreman
    create      bin/dev
     apply    /usr/local/bundle/gems/jsbundling-rails-1.3.0/lib/install/install_procfile.rb
  Add default Procfile.dev
    create      Procfile.dev
  Ensure foreman is installed
       run      gem install foreman from "."
Successfully installed foreman-0.88.1
1 gem installed
Install esbuild
       run    yarn add esbuild from "."
Add build script
bin/rails aborted!
Rails::Generators::Error: The template [/usr/local/bundle/gems/jsbundling-rails-1.3.0/lib/install/esbuild/install.rb] could not be loaded. Error: No such file or directory - npx (Rails::Generators::Error)


Caused by:
Errno::ENOENT: No such file or directory - npx (Errno::ENOENT)

Tasks: TOP => app:template
(See full trace by running task with --trace)
     rails  turbo:install stimulus:install
     apply  /usr/local/bundle/gems/turbo-rails-2.0.6/lib/install/turbo_with_node.rb
Import Turbo
    append    app/javascript/application.js
Install Turbo
       run    yarn add @hotwired/turbo-rails from "."
       run  bundle install --quiet
Run turbo:install:redis to switch on Redis and use it in development for turbo streams
     apply  /usr/local/bundle/gems/stimulus-rails-1.3.3/lib/install/stimulus_with_node.rb
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
Import Stimulus controllers
    append    app/javascript/application.js
Install Stimulus
       run    yarn add @hotwired/stimulus from "."
       run  bundle install --quiet
     rails  css:install:tailwind
     apply  /usr/local/bundle/gems/cssbundling-rails-1.4.0/lib/install/tailwind/install.rb
     apply    /usr/local/bundle/gems/cssbundling-rails-1.4.0/lib/install/install.rb
  Build into app/assets/builds
     exist      app/assets/builds
 identical      app/assets/builds/.keep
 unchanged      .gitignore
 unchanged      .gitignore
  Remove app/assets/stylesheets/application.css so build output can take over
    remove      app/assets/stylesheets/application.css
  Add stylesheet link tag in application layout
 unchanged      app/views/layouts/application.html.erb
    append      Procfile.dev
  Add bin/dev to start foreman
 identical      bin/dev
Install Tailwind (+PostCSS w/ autoprefixer)
    create    tailwind.config.js
    create    app/assets/stylesheets/application.tailwind.css
       run    yarn add tailwindcss@latest postcss@latest autoprefixer@latest from "."
Add build:css script
bin/rails aborted!
Rails::Generators::Error: The template [/usr/local/bundle/gems/cssbundling-rails-1.4.0/lib/install/tailwind/install.rb] could not be loaded. Error: No such file or directory - npx (Rails::Generators::Error)


Caused by:
Errno::ENOENT: No such file or directory - npx (Errno::ENOENT)

Tasks: TOP => app:template

With (--javascript=bun) ❌

When using the esbuild flag, the command is:

./rails-new --rails-version 7.2.0.beta3 \
  rails_playground \
  --css=tailwind \
  --database=postgresql \
  --asset-pipeline=propshaft \
  --javascript=bun \
  --devcontainer

Results in the following error:

Caused by:
Errno::ENOENT: No such file or directory - npx (Errno::ENOENT)
see the full error logs
./rails-new --rails-version 7.2.0.beta3 \
rails_playground \
--css=tailwind \
--database=postgresql \
--javascript=bun \
--asset-pipeline=propshaft \
--devcontainer
[+] Building 1.8s (7/7) FINISHED                                                                                               docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                           0.0s
 => => transferring dockerfile: 307B                                                                                                           0.0s
 => [internal] load metadata for docker.io/library/ruby:3.3.1                                                                                  1.7s
 => [auth] library/ruby:pull token for registry-1.docker.io                                                                                    0.0s
 => [internal] load .dockerignore                                                                                                              0.0s
 => => transferring context: 2B                                                                                                                0.0s
 => [1/2] FROM docker.io/library/ruby:3.3.1@sha256:797d68561a91415e05fd95178f467d86d77bce2d4f17f32683241a687cbd1705                            0.0s
 => CACHED [2/2] RUN if [ -z "7.2.0.beta3" ] ; then gem install rails ; else gem install rails -v 7.2.0.beta3 ; fi                             0.0s
 => exporting to image                                                                                                                         0.0s
 => => exporting layers                                                                                                                        0.0s
 => => writing image sha256:826431269572e80d02f93432a339c5044370632878a2cac89332e181df925c5e                                                   0.0s
 => => naming to docker.io/library/rails-new-3.3.1-7.2.0.beta3                                                                                 0.0s

What's next:
    View a summary of image vulnerabilities and recommendations → docker scout quickview 
      create  
      create  README.md
      create  Rakefile
      create  .ruby-version
      create  config.ru
      create  .gitignore
      create  .gitattributes
      create  Gemfile
         run  git init -b main from "."
Initialized empty Git repository in /Users/sultanmyrza/Development/rails-projects/rails_playground/.git/
      create  app
      create  app/assets/config/manifest.js
      create  app/assets/stylesheets/application.css
      create  app/channels/application_cable/channel.rb
      create  app/channels/application_cable/connection.rb
      create  app/controllers/application_controller.rb
      create  app/helpers/application_helper.rb
      create  app/jobs/application_job.rb
      create  app/mailers/application_mailer.rb
      create  app/models/application_record.rb
      create  app/views/layouts/application.html.erb
      create  app/views/layouts/mailer.html.erb
      create  app/views/layouts/mailer.text.erb
      create  app/views/pwa/manifest.json.erb
      create  app/views/pwa/service-worker.js
      create  app/assets/images
      create  app/assets/images/.keep
      create  app/controllers/concerns/.keep
      create  app/models/concerns/.keep
      create  bin
      create  bin/brakeman
      create  bin/rails
      create  bin/rake
      create  bin/rubocop
      create  bin/setup
      create  Dockerfile
      create  .dockerignore
      create  bin/docker-entrypoint
      create  .rubocop.yml
      create  .github/workflows
      create  .github/workflows/ci.yml
      create  .github/dependabot.yml
      create  config
      create  config/routes.rb
      create  config/application.rb
      create  config/environment.rb
      create  config/cable.yml
      create  config/puma.rb
      create  config/storage.yml
      create  config/environments
      create  config/environments/development.rb
      create  config/environments/production.rb
      create  config/environments/test.rb
      create  config/initializers
      create  config/initializers/assets.rb
      create  config/initializers/content_security_policy.rb
      create  config/initializers/cors.rb
      create  config/initializers/filter_parameter_logging.rb
      create  config/initializers/inflections.rb
      create  config/initializers/new_framework_defaults_7_2.rb
      create  config/initializers/permissions_policy.rb
      create  config/locales
      create  config/locales/en.yml
      create  config/master.key
      append  .gitignore
      create  config/boot.rb
      create  config/database.yml
      create  db
      create  db/seeds.rb
      create  lib
      create  lib/tasks
      create  lib/tasks/.keep
      create  lib/assets
      create  lib/assets/.keep
      create  log
      create  log/.keep
      create  public
      create  public/404.html
      create  public/406-unsupported-browser.html
      create  public/422.html
      create  public/500.html
      create  public/icon.png
      create  public/icon.svg
      create  public/robots.txt
      create  tmp
      create  tmp/.keep
      create  tmp/pids
      create  tmp/pids/.keep
      create  vendor
      create  vendor/.keep
      create  test/fixtures/files
      create  test/fixtures/files/.keep
      create  test/controllers
      create  test/controllers/.keep
      create  test/mailers
      create  test/mailers/.keep
      create  test/models
      create  test/models/.keep
      create  test/helpers
      create  test/helpers/.keep
      create  test/integration
      create  test/integration/.keep
      create  test/channels/application_cable/connection_test.rb
      create  test/test_helper.rb
      create  test/system
      create  test/system/.keep
      create  test/application_system_test_case.rb
      create  storage
      create  storage/.keep
      create  tmp/storage
      create  tmp/storage/.keep
      create  .devcontainer
      create  .devcontainer/devcontainer.json
      create  .devcontainer/Dockerfile
      create  .devcontainer/compose.yaml
        gsub  test/application_system_test_case.rb
   identical  config/database.yml
      remove  app/assets/config/manifest.js
      remove  app/assets/config
      remove  app/assets/stylesheets/application.css
      create  app/assets/stylesheets/application.css
      remove  config/initializers/cors.rb
      remove  config/initializers/new_framework_defaults_7_2.rb
         run  bundle install --quiet
         run  bundle lock --add-platform=x86_64-linux
Writing lockfile to /Users/sultanmyrza/Development/rails-projects/rails_playground/Gemfile.lock
         run  bundle binstubs bundler
       rails  javascript:install:bun
       apply  /usr/local/bundle/gems/jsbundling-rails-1.3.0/lib/install/bun/install.rb
       apply    /usr/local/bundle/gems/jsbundling-rails-1.3.0/lib/install/install.rb
    Compile into app/assets/builds
      create      app/assets/builds
      create      app/assets/builds/.keep
      append      .gitignore
      append      .gitignore
    Add JavaScript include tag in application layout
      insert      app/views/layouts/application.html.erb
    Create default entrypoint in app/javascript/application.js
      create      app/javascript
      create      app/javascript/application.js
    Add default package.json
      create      package.json
    Add bin/dev to start foreman
      create      bin/dev
  Add default Procfile.dev
      create    Procfile.dev
  Ensure foreman is installed
         run    gem install foreman from "."
Successfully installed foreman-0.88.1
1 gem installed
  Add default bun.config.js
      create    bun.config.js
  Add build script to package.json
  Add ability to diff lockb to .gitattributes
      append    .gitattributes
  Run `git config diff.lockb.textconv bun && git config diff.lockb.binary true` to enable pretty diffs for Bun's .lockb file
         run  bundle install --quiet
       rails  turbo:install stimulus:install
       apply  /usr/local/bundle/gems/turbo-rails-2.0.6/lib/install/turbo_with_bun.rb
  Import Turbo
      append    app/javascript/application.js
  Install Turbo
         run    bun add @hotwired/turbo-rails from "."
         run  bundle install --quiet
Run turbo:install:redis to switch on Redis and use it in development for turbo streams
       apply  /usr/local/bundle/gems/stimulus-rails-1.3.3/lib/install/stimulus_with_bun.rb
  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
  Import Stimulus controllers
      append    app/javascript/application.js
  Install Stimulus
         run    bun add @hotwired/stimulus from "."
         run  bundle install --quiet
       rails  css:install:tailwind
       apply  /usr/local/bundle/gems/cssbundling-rails-1.4.0/lib/install/tailwind/install.rb
       apply    /usr/local/bundle/gems/cssbundling-rails-1.4.0/lib/install/install.rb
    Build into app/assets/builds
       exist      app/assets/builds
   identical      app/assets/builds/.keep
   unchanged      .gitignore
   unchanged      .gitignore
    Remove app/assets/stylesheets/application.css so build output can take over
      remove      app/assets/stylesheets/application.css
    Add stylesheet link tag in application layout
   unchanged      app/views/layouts/application.html.erb
      append      Procfile.dev
    Add bin/dev to start foreman
   identical      bin/dev
  Install Tailwind (+PostCSS w/ autoprefixer)
      create    tailwind.config.js
      create    app/assets/stylesheets/application.tailwind.css
         run    yarn add tailwindcss@latest postcss@latest autoprefixer@latest from "."
  Add build:css script
bin/rails aborted!
Rails::Generators::Error: The template [/usr/local/bundle/gems/cssbundling-rails-1.4.0/lib/install/tailwind/install.rb] could not be loaded. Error: No such file or directory - npx (Rails::Generators::Error)


Caused by:
Errno::ENOENT: No such file or directory - npx (Errno::ENOENT)

Tasks: TOP => app:template
(See full trace by running task with --trace)

@onshi
Copy link
Contributor

onshi commented Aug 6, 2024

@sultanmyrza apparently for some weird reason --javascript=bun passes without issues 😅 what made it fail in your case was adding --css switch to the command

@excid3 do you have any particular preference how you would like to address this? I did a small experiment and built Dockerfile using mise to manage dev tools here is PR if you would like to take a look #23

@sultanmyrza
Copy link

@onshi yes I can confirm --javascript=bun without --css flag works ✅

./rails-new --rails-version 7.2.0.beta3 \
  rails_playground_bun_no_css \
  --database=postgresql \
  --asset-pipeline=propshaft \
  --javascript=bun \
  --devcontainer
logs [+] Building 1.9s (7/7) FINISHED docker:desktop-linux => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 307B 0.0s => [internal] load metadata for docker.io/library/ruby:3.3.1 1.8s => [auth] library/ruby:pull token for registry-1.docker.io 0.0s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [1/2] FROM docker.io/library/ruby:3.3.1@sha256:797d68561a91415e05fd95178f467d86d77bce2d4f17f32683241a687cbd1705 0.0s => CACHED [2/2] RUN if [ -z "7.2.0.beta3" ] ; then gem install rails ; else gem install rails -v 7.2.0.beta3 ; fi 0.0s => exporting to image 0.0s => => exporting layers 0.0s => => writing image sha256:826431269572e80d02f93432a339c5044370632878a2cac89332e181df925c5e 0.0s => => naming to docker.io/library/rails-new-3.3.1-7.2.0.beta3 0.0s

What's next:
View a summary of image vulnerabilities and recommendations → docker scout quickview
create
create README.md
create Rakefile
create .ruby-version
create config.ru
create .gitignore
create .gitattributes
create Gemfile
run git init -b main from "."
Initialized empty Git repository in /Users/sultanmyrza/Development/rails-projects/rails_playground_bun_no_css/.git/
create app
create app/assets/config/manifest.js
create app/assets/stylesheets/application.css
create app/channels/application_cable/channel.rb
create app/channels/application_cable/connection.rb
create app/controllers/application_controller.rb
create app/helpers/application_helper.rb
create app/jobs/application_job.rb
create app/mailers/application_mailer.rb
create app/models/application_record.rb
create app/views/layouts/application.html.erb
create app/views/layouts/mailer.html.erb
create app/views/layouts/mailer.text.erb
create app/views/pwa/manifest.json.erb
create app/views/pwa/service-worker.js
create app/assets/images
create app/assets/images/.keep
create app/controllers/concerns/.keep
create app/models/concerns/.keep
create bin
create bin/brakeman
create bin/rails
create bin/rake
create bin/rubocop
create bin/setup
create Dockerfile
create .dockerignore
create bin/docker-entrypoint
create .rubocop.yml
create .github/workflows
create .github/workflows/ci.yml
create .github/dependabot.yml
create config
create config/routes.rb
create config/application.rb
create config/environment.rb
create config/cable.yml
create config/puma.rb
create config/storage.yml
create config/environments
create config/environments/development.rb
create config/environments/production.rb
create config/environments/test.rb
create config/initializers
create config/initializers/assets.rb
create config/initializers/content_security_policy.rb
create config/initializers/cors.rb
create config/initializers/filter_parameter_logging.rb
create config/initializers/inflections.rb
create config/initializers/new_framework_defaults_7_2.rb
create config/initializers/permissions_policy.rb
create config/locales
create config/locales/en.yml
create config/master.key
append .gitignore
create config/boot.rb
create config/database.yml
create db
create db/seeds.rb
create lib
create lib/tasks
create lib/tasks/.keep
create lib/assets
create lib/assets/.keep
create log
create log/.keep
create public
create public/404.html
create public/406-unsupported-browser.html
create public/422.html
create public/500.html
create public/icon.png
create public/icon.svg
create public/robots.txt
create tmp
create tmp/.keep
create tmp/pids
create tmp/pids/.keep
create vendor
create vendor/.keep
create test/fixtures/files
create test/fixtures/files/.keep
create test/controllers
create test/controllers/.keep
create test/mailers
create test/mailers/.keep
create test/models
create test/models/.keep
create test/helpers
create test/helpers/.keep
create test/integration
create test/integration/.keep
create test/channels/application_cable/connection_test.rb
create test/test_helper.rb
create test/system
create test/system/.keep
create test/application_system_test_case.rb
create storage
create storage/.keep
create tmp/storage
create tmp/storage/.keep
create .devcontainer
create .devcontainer/devcontainer.json
create .devcontainer/Dockerfile
create .devcontainer/compose.yaml
gsub test/application_system_test_case.rb
identical config/database.yml
remove app/assets/config/manifest.js
remove app/assets/config
remove app/assets/stylesheets/application.css
create app/assets/stylesheets/application.css
remove config/initializers/cors.rb
remove config/initializers/new_framework_defaults_7_2.rb
run bundle install --quiet
run bundle lock --add-platform=x86_64-linux
Writing lockfile to /Users/sultanmyrza/Development/rails-projects/rails_playground_bun_no_css/Gemfile.lock
run bundle binstubs bundler
rails javascript:install:bun
apply /usr/local/bundle/gems/jsbundling-rails-1.3.1/lib/install/bun/install.rb
apply /usr/local/bundle/gems/jsbundling-rails-1.3.1/lib/install/install.rb
Compile into app/assets/builds
create app/assets/builds
create app/assets/builds/.keep
append .gitignore
append .gitignore
Add JavaScript include tag in application layout
insert app/views/layouts/application.html.erb
Create default entrypoint in app/javascript/application.js
create app/javascript
create app/javascript/application.js
Add default package.json
create package.json
Add bin/dev to start foreman
create bin/dev
Add default Procfile.dev
create Procfile.dev
Ensure foreman is installed
run gem install foreman from "."
Successfully installed foreman-0.88.1
1 gem installed
Add default bun.config.js
create bun.config.js
Add build script to package.json
Add ability to diff lockb to .gitattributes
append .gitattributes
Run git config diff.lockb.textconv bun && git config diff.lockb.binary true to enable pretty diffs for Bun's .lockb file
run bundle install --quiet
rails turbo:install stimulus:install
apply /usr/local/bundle/gems/turbo-rails-2.0.6/lib/install/turbo_with_bun.rb
Import Turbo
append app/javascript/application.js
Install Turbo
run bun add @hotwired/turbo-rails from "."
run bundle install --quiet
Run turbo:install:redis to switch on Redis and use it in development for turbo streams
apply /usr/local/bundle/gems/stimulus-rails-1.3.3/lib/install/stimulus_with_bun.rb
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
Import Stimulus controllers
append app/javascript/application.js
Install Stimulus
run bun add @hotwired/stimulus from "."
run bundle install --quiet

However --javascrip esbuild without --css flag still fails ❌

./rails-new --rails-version 7.2.0.beta3 \
  rails_playground_esbuild_no_css \
  --database=postgresql \
  --asset-pipeline=propshaft \
  --javascript=esbuild \
  --devcontainer
logs

[+] Building 0.9s (6/6) FINISHED docker:desktop-linux
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 307B 0.0s
=> [internal] load metadata for docker.io/library/ruby:3.3.1 0.9s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [1/2] FROM docker.io/library/ruby:3.3.1@sha256:797d68561a91415e05fd95178f467d86d77bce2d4f17f32683241a687cbd1705 0.0s
=> CACHED [2/2] RUN if [ -z "7.2.0.beta3" ] ; then gem install rails ; else gem install rails -v 7.2.0.beta3 ; fi 0.0s
=> exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:826431269572e80d02f93432a339c5044370632878a2cac89332e181df925c5e 0.0s
=> => naming to docker.io/library/rails-new-3.3.1-7.2.0.beta3 0.0s

What's next:
View a summary of image vulnerabilities and recommendations → docker scout quickview
create
create README.md
create Rakefile
create .node-version
create .ruby-version
create config.ru
create .gitignore
create .gitattributes
create Gemfile
run git init -b main from "."
Initialized empty Git repository in /Users/sultanmyrza/Development/rails-projects/rails_playground_esbuild_no_css/.git/
create app
create app/assets/config/manifest.js
create app/assets/stylesheets/application.css
create app/channels/application_cable/channel.rb
create app/channels/application_cable/connection.rb
create app/controllers/application_controller.rb
create app/helpers/application_helper.rb
create app/jobs/application_job.rb
create app/mailers/application_mailer.rb
create app/models/application_record.rb
create app/views/layouts/application.html.erb
create app/views/layouts/mailer.html.erb
create app/views/layouts/mailer.text.erb
create app/views/pwa/manifest.json.erb
create app/views/pwa/service-worker.js
create app/assets/images
create app/assets/images/.keep
create app/controllers/concerns/.keep
create app/models/concerns/.keep
create bin
create bin/brakeman
create bin/rails
create bin/rake
create bin/rubocop
create bin/setup
create Dockerfile
create .dockerignore
create bin/docker-entrypoint
create .rubocop.yml
create .github/workflows
create .github/workflows/ci.yml
create .github/dependabot.yml
create config
create config/routes.rb
create config/application.rb
create config/environment.rb
create config/cable.yml
create config/puma.rb
create config/storage.yml
create config/environments
create config/environments/development.rb
create config/environments/production.rb
create config/environments/test.rb
create config/initializers
create config/initializers/assets.rb
create config/initializers/content_security_policy.rb
create config/initializers/cors.rb
create config/initializers/filter_parameter_logging.rb
create config/initializers/inflections.rb
create config/initializers/new_framework_defaults_7_2.rb
create config/initializers/permissions_policy.rb
create config/locales
create config/locales/en.yml
create config/master.key
append .gitignore
create config/boot.rb
create config/database.yml
create db
create db/seeds.rb
create lib
create lib/tasks
create lib/tasks/.keep
create lib/assets
create lib/assets/.keep
create log
create log/.keep
create public
create public/404.html
create public/406-unsupported-browser.html
create public/422.html
create public/500.html
create public/icon.png
create public/icon.svg
create public/robots.txt
create tmp
create tmp/.keep
create tmp/pids
create tmp/pids/.keep
create vendor
create vendor/.keep
create test/fixtures/files
create test/fixtures/files/.keep
create test/controllers
create test/controllers/.keep
create test/mailers
create test/mailers/.keep
create test/models
create test/models/.keep
create test/helpers
create test/helpers/.keep
create test/integration
create test/integration/.keep
create test/channels/application_cable/connection_test.rb
create test/test_helper.rb
create test/system
create test/system/.keep
create test/application_system_test_case.rb
create storage
create storage/.keep
create tmp/storage
create tmp/storage/.keep
create .devcontainer
create .devcontainer/devcontainer.json
create .devcontainer/Dockerfile
create .devcontainer/compose.yaml
gsub test/application_system_test_case.rb
identical config/database.yml
remove app/assets/config/manifest.js
remove app/assets/config
remove app/assets/stylesheets/application.css
create app/assets/stylesheets/application.css
remove config/initializers/cors.rb
remove config/initializers/new_framework_defaults_7_2.rb
run bundle install --quiet
run bundle lock --add-platform=x86_64-linux
Writing lockfile to /Users/sultanmyrza/Development/rails-projects/rails_playground_esbuild_no_css/Gemfile.lock
run bundle binstubs bundler
rails javascript:install:esbuild
apply /usr/local/bundle/gems/jsbundling-rails-1.3.1/lib/install/esbuild/install.rb
apply /usr/local/bundle/gems/jsbundling-rails-1.3.1/lib/install/install.rb
Compile into app/assets/builds
create app/assets/builds
create app/assets/builds/.keep
append .gitignore
append .gitignore
Add JavaScript include tag in application layout
insert app/views/layouts/application.html.erb
Create default entrypoint in app/javascript/application.js
create app/javascript
create app/javascript/application.js
Add default package.json
create package.json
Add bin/dev to start foreman
create bin/dev
apply /usr/local/bundle/gems/jsbundling-rails-1.3.1/lib/install/install_procfile.rb
Add default Procfile.dev
create Procfile.dev
Ensure foreman is installed
run gem install foreman from "."
Successfully installed foreman-0.88.1
1 gem installed
Install esbuild
run yarn add --dev esbuild from "."
Add build script
bin/rails aborted!
Rails::Generators::Error: The template [/usr/local/bundle/gems/jsbundling-rails-1.3.1/lib/install/esbuild/install.rb] could not be loaded. Error: No such file or directory - npx (Rails::Generators::Error)

Caused by:
Errno::ENOENT: No such file or directory - npx (Errno::ENOENT)

Tasks: TOP => app:template
(See full trace by running task with --trace)
rails turbo:install stimulus:install
apply /usr/local/bundle/gems/turbo-rails-2.0.6/lib/install/turbo_with_node.rb
Import Turbo
append app/javascript/application.js
Install Turbo
run yarn add @hotwired/turbo-rails from "."
run bundle install --quiet
Run turbo:install:redis to switch on Redis and use it in development for turbo streams
apply /usr/local/bundle/gems/stimulus-rails-1.3.3/lib/install/stimulus_with_node.rb
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
Import Stimulus controllers
append app/javascript/application.js
Install Stimulus
run yarn add @hotwired/stimulus from "."
run bundle install --quiet

@atstockland
Copy link

Any updates on this?

@onshi
Copy link
Contributor

onshi commented Sep 12, 2024

@atstockland PR #23 is ready to go, waiting for a review from Rafael

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants