Skip to content

Instantly share code, notes, and snippets.

@stevepolitodesign
Last active May 7, 2024 09:48
Show Gist options
  • Save stevepolitodesign/cea4f42795d6732a3f81c6670693bdc5 to your computer and use it in GitHub Desktop.
Save stevepolitodesign/cea4f42795d6732a3f81c6670693bdc5 to your computer and use it in GitHub Desktop.
Rails node_version error
irb(main):001* ENV.fetch("NODE_VERSION") do
irb(main):002* `node --version`
irb(main):003* rescue
irb(main):004* "1.2.3"
irb(main):005> end
=> "1.2.3"
irb(main):006> exit
~/Desktop took 7s
❯ rails new node_demo \
∙ --main \
∙ --javascript=esbuild \
∙ --css=postcss
create
create Gemfile
run bundle install
Fetching https://github.com/rails/rails.git
Resolving dependencies...
Fetching gem metadata from https://rubygems.org/..........
Fetching irb 1.13.1
Installing irb 1.13.1
Bundle complete! 1 Gemfile dependency, 58 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
run bundle exec rails new /Users/polito/Desktop/node_demo --main --javascript\=esbuild --css\=postcss
exist
remove Gemfile
remove Gemfile.lock
create README.md
create Rakefile
create .node-version
create .ruby-version
create config.ru
create .gitignore
create .gitattributes
create Gemfile
run git init from "."
Initialized empty Git repository in /Users/polito/Desktop/node_demo/.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
env: node: No such file or directory
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/enable_yjit.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
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/polito/Desktop/node_demo/Gemfile.lock
run bundle lock --add-platform=aarch64-linux
Writing lockfile to /Users/polito/Desktop/node_demo/Gemfile.lock
run bundle binstubs bundler
rails javascript:install:esbuild
apply /Users/polito/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/jsbundling-rails-1.3.0/lib/install/esbuild/install.rb
apply /Users/polito/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/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 /Users/polito/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/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 "."
env: node: No such file or directory
Add build script
bin/rails aborted!
Rails::Generators::Error: The template [/Users/polito/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/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 /Users/polito/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/turbo-rails-2.0.5/lib/install/turbo_with_node.rb
Import Turbo
append app/javascript/application.js
Install Turbo
run yarn add @hotwired/turbo-rails from "."
env: node: No such file or directory
run bundle install --quiet
apply /Users/polito/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/turbo-rails-2.0.5/lib/install/turbo_needs_redis.rb
Enable redis in bundle
gsub Gemfile
run bundle install --quiet
Switch development cable to use redis
gsub config/cable.yml
run bundle install --quiet
apply /Users/polito/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/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 "."
env: node: No such file or directory
run bundle install --quiet
rails css:install:postcss
apply /Users/polito/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/cssbundling-rails-1.4.0/lib/install/postcss/install.rb
apply /Users/polito/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/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 PostCSS w/ nesting and autoprefixer
create postcss.config.js
create app/assets/stylesheets/application.postcss.css
run yarn add postcss postcss-cli postcss-import postcss-nesting autoprefixer from "."
env: node: No such file or directory
Add build:css script
bin/rails aborted!
Rails::Generators::Error: The template [/Users/polito/.asdf/installs/ruby/3.3.0/lib/ruby/gems/3.3.0/gems/cssbundling-rails-1.4.0/lib/install/postcss/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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment