stimulus_reflex
stimulus_reflex copied to clipboard
NameError: undefined local variable or method `package_json'
Bug Report
Describe the bug
While executing rails stimulus_reflex:install on a brand new application using esbuild as js bundler, I get the following error during the yarn step:
--- [yarn] ----
rails aborted!
NameError: undefined local variable or method `package_json' for #<Rails::Generators::AppGenerator:0x0000000107302b38 @argv=[#<Pathname:/Users/robison/Documents/Development/ruby/stimulus_reflex>], @gem_filter=#<Proc:0x00000001073029a8 /Users/robison/.rvm/gems/ruby-3.0.6/gems/railties-7.0.8/lib/rails/generators/app_base.rb:105 (lambda)>, @behavior=:invoke, @_invocations={}, @_initializer=[[#<Pathname:/Users/robison/Documents/Development/ruby/stimulus_reflex>], {}, {:destination_root=>#<Pathname:/Users/robison/Documents/Development/ruby/stimulus_reflex>}], @options={"skip_namespace"=>false, "skip_collision_check"=>false, "ruby"=>"/Users/robison/.rvm/rubies/ruby-3.0.6/bin/ruby", "database"=>"sqlite3", "skip_git"=>false, "skip_keeps"=>false, "skip_action_mailer"=>false, "skip_action_mailbox"=>false, "skip_action_text"=>false, "skip_active_record"=>false, "skip_active_job"=>false, "skip_active_storage"=>false, "skip_action_cable"=>false, "skip_asset_pipeline"=>false, "asset_pipeline"=>"sprockets", "skip_javascript"=>false, "skip_hotwire"=>false, "skip_jbuilder"=>false, "skip_test"=>false, "skip_system_test"=>false, "skip_bootsnap"=>false, "dev"=>false, "edge"=>false, "main"=>false, "no_rc"=>false, "api"=>false, "javascript"=>"importmap", "skip_bundle"=>false}, @app_path=#<Pathname:/Users/robison/Documents/Development/ruby/stimulus_reflex>, @args=[], @shell=#<Thor::Shell::Color:0x000000012c5f1b58 @base=#<Rails::Generators::AppGenerator:0x0000000107302b38 ...>, @mute=false, @padding=0, @always_force=false>, @destination_stack=["/Users/robison/Documents/Development/ruby/stimulus_reflex"], @indentation=0, @after_bundle_callbacks=[], @source_paths=["/Users/robison/.rvm/gems/ruby-3.0.6/gems/railties-7.0.8/lib/rails/generators/rails/app/templates"], @package_json_path=#<Pathname:/Users/robison/Documents/Development/ruby/stimulus_reflex/package.json>, @package_list=#<Pathname:/Users/robison/Documents/Development/ruby/stimulus_reflex/tmp/stimulus_reflex_installer/npm_package_list>, @dev_package_list=#<Pathname:/Users/robison/Documents/Development/ruby/stimulus_reflex/tmp/stimulus_reflex_installer/npm_dev_package_list>, @drop_package_list=#<Pathname:/Users/robison/Documents/Development/ruby/stimulus_reflex/tmp/stimulus_reflex_installer/drop_npm_package_list>>
Did you mean? package_json_path
To Reproduce
-
rails new stimulus_reflex -j esbuild -
bundle add stimulus_reflex --version 3.5.0.rc3 -
rails stimulus_reflex:install
Expected behavior
No errors after running the install command.
Screenshots or reproduction
NA
Versions
StimulusReflex
- Gem: 3.5.0.rc3
- Node package: I guess the step that is failing is supposed to install the JS package
External tools
- Ruby: 3.0.6
- Rails: 7.0.8
- Node: v20.3.0
Browser
- NA
Hey @robisonsantos, thanks for reporting.
I think this should be resolved via #676. I'm hoping to release a new version in the coming days.
Perfect!
This should be resolved with the release of v3.5.0.rc4. I'm going to close this issue, but please feel free to re-open if you are still seeing something unexpected!