Open excid3 opened 1 month ago
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)
Tested on:
--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
--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)
--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)
@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 https://github.com/rails/rails-new/pull/23
@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
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
If you run
rails-new main --js esbuild
, you'll get the following error becausenpx
is not available.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.