Skip to content

Getting an error with my Custom Javascript

Technical Support
3 2 1.3k 2

Suggested Topics


  • custom page template's javascript in wrong place?

    Solved Technical Support
    5
    0 Votes
    5 Posts
    2k Views
    B
    @baris Thank you. Very valuable feedback. Ought the theme quickstart to be kept in sync with the plugin quickstart?
  • 0 Votes
    1 Posts
    925 Views
    QwsQ
    Full error: 2020-05-30T14:05:05.137Z [27866] - error: [build] admin control panel styles build failed 2020-05-30T14:05:05.176Z [27866] - error: resource 'https://fonts.googleapis.com/css?family=Roboto:300,400,500,700' gave this Error: Error: Client network socket disconnected before secure TLS connection was established {"type":"File","filename":"/home/pi/nodebb/public/less/admin/paper/bootswatch.less","index":87,"line":5,"column":0,"callLine":null,"extract":["","@import url("https://fonts.googleapis.com/css?family=Roboto:300,400,500,700\");",""]}
  • custom javascript error

    Technical Support
    3
    0 Votes
    3 Posts
    2k Views
    oplik0O
    Just a correction: it's not that you don't need the <script> - it's just illegal unless you're writing something like jsx. When run this will immediatly cause Uncaught SyntaxError: Unexpected token '<' - because everything you put in custom Javascript is already put into a <script> tag. If you want to include another script either use some kind of imports (for example es modules) that works inside JS, or put the <script src=""> tag in custom header instead.
  • In which version did Custom Javascript show up?

    Technical Support
    23
    1 Votes
    23 Posts
    9k Views
    R
    Well I am embarrassed, I figured out the problem! There is no problem with custom javascript or the custom header information. It turns out the nodebb-plugin-ns-twitch-monitor was the problem! The plugin does not seem to work after a certain version of NodeBB and where I had it placed in my widgets must have been causing the custom header code to not load or run properly. I am still running v1.4.5 but am moving over to a new server, yes after all of these years. In doing so I have been incrementally stepping through upgrades, 1.4.5 -> 1.5.x -> 1.6.x -> 1.7.x... It was there at the 1.7.x that my custom Piwik (Matomo) code stopped working. I put NodeBB into "dev" mode and saw a number of errors related to the Twitch plugin. I removed the plugin and my analytics code now works fine. It is bittersweet as I really like the Twitch plugin on my forum but the plugin stopped working quite some time ago. Twitch changed how their API works and the plugin was never updated to keep up. Shouting out to a list of people for closure on this, in case you were all losing sleep on this since May of last year! @baris @julian @Nicolas
  • How can I get more specific build error message

    Technical Support
    7
    1 Votes
    7 Posts
    3k Views
    Gus SurarezG
    It was rather trivial to add the error message, here is how: in uglify-js module, added a error reporting log to the file lib\parse.js in following method: function js_error(message, filename, line, col, pos) { console.log(message, filename, line, col, pos); throw new JS_Parse_Error(message, filename, line, col, pos); }; Looks like the error handling of fault barrier doesn't do what it supposed to. @PitaJ Thank again for your help.

Looks like your connection to NodeBB Community was lost, please wait while we try to reconnect.