Get 2024 Templates Mega Bundle!$1000 worth of 19 Bootstrap HTML, Vue & React Templates + 3 Vector Sets for just $9
Get for 99$

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
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • 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
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(