All original content is created in Ukrainian. Not all content has been translated yet. Some posts may only be available in Ukrainian.Learn more

[Fix] Rails Admin - undefined local variable or method javascript_importmap_shim_nonce_configuration_tag

This content has been automatically translated from Ukrainian.
After updating Ruby Gems, an error occurred on the Rails Admin page.
undefined local variable or method `javascript_importmap_shim_nonce_configuration_tag' for #<ActionView::Base:0x00000000017908>

NameError in RailsAdmin::Main#dashboard

Showing /Users/user/.rbenv/versions/3.2.1/lib/ruby/gems/3.2.0/gems/rails_admin-3.1.2/app/views/layouts/rails_admin/_head.html.erb where line #22 raised:
undefined local variable or method `javascript_importmap_shim_nonce_configuration_tag' for #<ActionView::Base:0x00000000017908>
Extracted source (around line #22):
undefined local variable or method `javascript_importmap_shim_nonce_configuration_tag' for #<ActionView::Base:0x00000000017908>
undefined local variable or method `javascript_importmap_shim_nonce_configuration_tag' for #<ActionView::Base:0x00000000017908>
This happened due to the update to the major version of importmap-rails.
importmap-rails оновлення
importmap-rails оновлення
So currently the simplest fix is to lock the version in the Gemfile:
gem "importmap-rails", "~> 1.1.5"
Then:
bundle install
And Rails Admin should work. I haven't read in detail the benefits of updating to importmap-rails, but evidently Rails Admin does not currently support this version. So we need to wait a bit for the update of this library.

This post doesn't have any additions from the author yet.

What is a prompt and prompt engineering?
03 May 12:08

What is a prompt and prompt engineering?

meme code
meme code@memecode
ZOMBIE in Ruby. What is it?
03 May 12:41

ZOMBIE in Ruby. What is it?

meme code
meme code@memecode
03 May 13:13

What is a Garbage Collector in Ruby? How does it work and what is GC needed for?

meme code
meme code@memecode
A bit about Ruby implementation types (CRuby (MRI), JRuby, Rubinius, TruffleRuby, mruby)
05 May 12:36

A bit about Ruby implementation types (CRuby (MRI), JRuby, Rubinius, TruffleRuby, mruby)

meme code
meme code@memecode
07 May 07:24

What is native machine code?

meme code
meme code@memecode
Enabling YJIT in Ruby 3.2.1 (Ruby on Rails)
08 May 07:57

Enabling YJIT in Ruby 3.2.1 (Ruby on Rails)

meme code
meme code@memecode
What is technical debt in IT projects?
13 May 06:17

What is technical debt in IT projects?

meme code
meme code@memecode
13 May 07:11

What does scope mean in IT project management?

meme code
meme code@memecode
What is "scope creep"?
13 May 07:20

What is "scope creep"?

meme code
meme code@memecode
What does "Native" mean?
22 May 07:01

What does "Native" mean?

meme code
meme code@memecode
How does 'rails console --sandbox' work?
23 May 19:39

How does 'rails console --sandbox' work?

meme code
meme code@memecode
What is the purpose of the CVE (Common Vulnerabilities and Exposures) database?
29 May 08:05

What is the purpose of the CVE (Common Vulnerabilities and Exposures) database?

meme code
meme code@memecode