Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

Uncaught TypeError: Cannot read properties of undefined


I'm trying to integrate Metronic 8.2.7 into my Rails project. CSS part was very easy. However, Javascript part is a pain in the ass. I have been dealing with this a lot of hours without success. Metronic is heavy dependent on Javascript. Basically, the issue is with the scripts.bundle.js, because KTApp init function is never instantiated.

// Init components
var KTComponents = function () {
// Public methods
return {
init: function () {
KTApp.init(); -> here it's the error (Uncaught TypeError: Cannot read properties of undefined (reading 'init')
KTDrawer.init();
KTMenu.init();
KTScroll.init();
KTSticky.init();
KTSwapper.init();
KTToggle.init();
KTScrolltop.init();
KTDialer.init();
KTImageInput.init();
KTPasswordMeter.init();
}
}
}();

Any way to make this Metronic HTML version work in my Rails 7 app?


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (3)


Hi Gustavo,

Glad to hear! If you need any further assistance or have any questions as you continue, feel free to reach out.



Hi Gustavo Toro

Sorry for the delay. Regarding the scripts.bundle.js file, did you obtain it from the Metronic HTML dist/assets directory? Also, from the Metronic HTML tools folder, which builds tool are you using—Gulp or Webpack?

Can you try with gulp build?

Thank you



Hi Faizal,

I read part of the documentation and found the Rails project (I was using the HTML version) and now I have fully integrated the dashboard I need. Thanks.


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(