Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stimulus controller not loading

I'm getting this message on my console and I cannot find a solution:

Failed to register controller: search (controllers/search_controller) TypeError: The 'stimulus' specifier was a simple specifier, but it has not been remapped to anything. Relative module specifiers must start with './', '../', or '/'.

I'm using rails 7.0.2 and importmap.rb to install my JS.

I tried rerouting the import.map and redoing the stimulus documentation manual installing and it hadn't worked.

like image 937
Arthur Finamore Avatar asked Nov 04 '25 03:11

Arthur Finamore


1 Answers

You're importing from stimulus in your search_controller.js. You need to change all references from stimulus to @hotwired/stimulus:

// import { Controller } from "stimulus"
import { Controller } from "@hotwired/stimulus"
like image 106
Alex Avatar answered Nov 06 '25 19:11

Alex



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!