0

I'm updating a fairly old project to rails 6, and adapt to current "rails ways". And I've just installed webpacker, but I've run into problem I can't seem to find a way to solve.

When running the project, I get this error: Uncaught Error: Cannot find module '@rails/ujs'

I've tried to reinstall rails-ujs through yarn, but to no effect.

Also I've tried to comment the line require("@rails/ujs").start() from my app/javascript/packs/application.js, and yet I got another error: Uncaught Error: Cannot find module '@rails/activestorage'.

Which leads me to believe that its the global @rails that is not being recognized, however I have no idea where is it set or how to do so.

My questions are: Can I set @rails myself?

Is there a way to re-generate it?

or

Is there another configuration I should fix?

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
  • Does this answer your question? [Cannot find module '@rails/ujs' - Rails 6 Webpack App](https://stackoverflow.com/questions/59344632/cannot-find-module-rails-ujs-rails-6-webpack-app) – Tom Harvey Oct 21 '20 at 22:06

1 Answers1

0

It’s not @rails which is missing, it’s the ujs (and active storage) JavaScript packages which are missing.

Run yarn install To install them.

Tom Harvey
  • 3,681
  • 3
  • 19
  • 28
  • Thank you for the sugestion, but I rave already run ```yarn install```, also i've seen the question you mentioned on the other comment and tried it's sugestions, but still not working – Marcelo-Zanini Oct 23 '20 at 12:55