Skip to content
New issue

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

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

Already on GitHub? # to your account

Gem install error with importmap #3609

Closed
kolasss opened this issue Mar 21, 2023 · 1 comment
Closed

Gem install error with importmap #3609

kolasss opened this issue Mar 21, 2023 · 1 comment

Comments

@kolasss
Copy link

kolasss commented Mar 21, 2023

Describe the bug
When running install generator of the gem on the newest rails with importmap I've got an exception
After debugging I found that importmap calling api.jspm.io/generate and the site returns Error: No provider named "jspm" has been defined.
I don't know much about js generation, is it temporary error or we need to fix something?

Reproduction steps
create new app rails new example-app
add gem rails_admin and run bundle install
run bin/rails g rails_admin:install

Expected behavior
should install without errors

Additional context

  • rails version: 7.0.4.3
  • rails_admin version: 3.1.1
  • rails_admin npm package version: 3.1.1
  • full stack trace (if there's an exception)
/usr/local/bundle/gems/rails_admin-3.1.1/lib/generators/rails_admin/importmap_formatter.rb:17:in `format': undefined method `[]' for nil:NilClass (NoMethodError)

      imports['@popperjs/core'].gsub!('lib/index.js', 'dist/esm/popper.js')
             ^^^^^^^^^^^^^^^^^^
	from /usr/local/bundle/gems/rails_admin-3.1.1/lib/generators/rails_admin/install_generator.rb:88:in `configure_for_importmap'
	from /usr/local/bundle/gems/rails_admin-3.1.1/lib/generators/rails_admin/install_generator.rb:33:in `install'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/invocation.rb:134:in `block in invoke_all'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/invocation.rb:134:in `each'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/invocation.rb:134:in `map'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/invocation.rb:134:in `invoke_all'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/group.rb:232:in `dispatch'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
	from /usr/local/bundle/gems/railties-7.0.4.2/lib/rails/generators.rb:263:in `invoke'
	from /usr/local/bundle/gems/railties-7.0.4.2/lib/rails/commands/generate/generate_command.rb:26:in `perform'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from /usr/local/bundle/gems/railties-7.0.4.2/lib/rails/command/base.rb:87:in `perform'
	from /usr/local/bundle/gems/railties-7.0.4.2/lib/rails/command.rb:48:in `invoke'
	from /usr/local/bundle/gems/railties-7.0.4.2/lib/rails/commands.rb:18:in `<main>'
	from <internal:/usr/local/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
	from <internal:/usr/local/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
	from /usr/local/bundle/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from bin/rails:6:in `<main>'
@mshibuya
Copy link
Member

The cause was a change on the jspm side.
jspm/generator#235
Though the fix is being in place on their side, I thought it's good to place a workaround on our side since it's a tiny change. Now fixed in the master.

Thank you for reporting! 👍

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

No branches or pull requests

2 participants