ajaxify error after override header template



  • Hi,

    I made everything as in instruction. In my own theme (created by quickstart) I created templates directory. I needed to change something in header.tpl, so I putted original header.tpl into my templates directory. After cmds:

    nodebb build && nodebb start i've got console error:

    nodebb.min.js?v=ped6uodgli8:17928 Uncaught TypeError: Cannot read property 'startsWith' of undefined
        at Object.ajaxify.loadScript (nodebb.min.js?v=ped6uodgli8:17928)
        at Object.ajaxify.end (nodebb.min.js?v=ped6uodgli8:17896)
        at Object.app.load (nodebb.min.js?v=ped6uodgli8:16798)
        at HTMLDocument.<anonymous> (nodebb.min.js?v=ped6uodgli8:18128)
        at mightThrow (nodebb.min.js?v=ped6uodgli8:4064)
        at process (nodebb.min.js?v=ped6uodgli8:4132)
    

    I haven't change anything in copied header.tpl. It's the same template as original - but in my theme-templates dir. What's going on?

    I tried to put entire templates dir. from original Persona Theme, but after this I have console problems with define is not defined and JavaScript is crashing. (modules are not working fine, even nodebb.min.js is not created.);

    Thanks for reacting,
    and please try to solve this problem.


  • Admin Staff

    Please share your header.tpl and nodebb version you are using.



  • <!DOCTYPE html>
    <html lang="{function.localeToHTML, userLang, defaultLang}" <!-- IF languageDirection -->data-dir="{languageDirection}" style="direction: {languageDirection};" <!-- ENDIF languageDirection --> >
    <head>
        <title>{browserTitle}</title>
        {{{each metaTags}}}{function.buildMetaTag}{{{end}}}
        <link rel="stylesheet" type="text/css" href="{relative_path}/assets/client<!-- IF bootswatchSkin -->-{bootswatchSkin}<!-- END -->.css?{config.cache-buster}" />
        {{{each linkTags}}}{function.buildLinkTag}{{{end}}}
    
        <script>
            var config = JSON.parse('{{configJSON}}');
            var app = {
                user: JSON.parse('{{userJSON}}')
            };
        </script>
    
        <!-- IF useCustomHTML -->
        {{customHTML}}
        <!-- END -->
        <!-- IF useCustomCSS -->
        <style>{{customCSS}}</style>
        <!-- END -->
    </head>
    
    <body class="{bodyClass} skin-<!-- IF bootswatchSkin -->{bootswatchSkin}<!-- ELSE -->noskin<!-- END -->">
    <nav id="menu" class="slideout-menu hidden">
        <!-- IMPORT partials/slideout-menu.tpl -->
    </nav>
    <nav id="chats-menu" class="slideout-menu hidden">
        <!-- IMPORT partials/chats-menu.tpl -->
    </nav>
    
    <main id="panel" class="slideout-panel">
        <nav class="navbar navbar-default navbar-fixed-top header" id="header-menu" component="navbar">
            <div class="container">
                <!-- IMPORT partials/menu.tpl -->
            </div>
        </nav>
        <div class="container" id="content">
            <!-- IMPORT partials/noscript/warning.tpl -->
    

    Nodebb version from package.json
    "version": "1.13.4-5"


  • GNU/Linux Admin

    Are there errors when you run ./nodebb build? How about during running of NodeBB?



  • ./nodebb build looks clean;

    ./nodebb build
      started
    (node:13178) ExperimentalWarning: Conditional exports is an experimental feature. This feature could change at any time
    2020-09-13T21:41:18.053Z [4567/13178] - info: [build] Building in parallel mode
    2020-09-13T21:41:18.053Z [4567/13178] - info: [build]         plugin static dirs  build started
    2020-09-13T21:41:18.054Z [4567/13178] - info: [build]          requirejs modules  build started
    2020-09-13T21:41:18.055Z [4567/13178] - info: [build]           client js bundle  build started
    2020-09-13T21:41:18.057Z [4567/13178] - info: [build]            admin js bundle  build started
    2020-09-13T21:41:18.057Z [4567/13178] - info: [build]         client side styles  build started
    2020-09-13T21:41:18.057Z [4567/13178] - info: [build] admin control panel styles  build started
    2020-09-13T21:41:18.057Z [4567/13178] - info: [build]                  templates  build started
    2020-09-13T21:41:18.058Z [4567/13178] - info: [build]                  languages  build started
    2020-09-13T21:41:18.058Z [4567/13178] - info: [build]                     sounds  build started
    2020-09-13T21:41:18.356Z [4567/13178] - info: [build]                     sounds  build completed in 0.298sec
    2020-09-13T21:41:18.373Z [4567/13178] - info: [build]         plugin static dirs  build completed in 0.32sec
    (node:13191) ExperimentalWarning: Conditional exports is an experimental feature. This feature could change at any time
    (node:13204) ExperimentalWarning: Conditional exports is an experimental feature. This feature could change at any time
    (node:13198) ExperimentalWarning: Conditional exports is an experimental feature. This feature could change at any time
    (node:13213) ExperimentalWarning: Conditional exports is an experimental feature. This feature could change at any time
    (node:13220) ExperimentalWarning: Conditional exports is an experimental feature. This feature could change at any time
    2020-09-13T21:41:22.275Z [4567/13178] - info: [build]            admin js bundle  build completed in 4.218sec
    2020-09-13T21:41:22.276Z [4567/13178] - info: [build]           client js bundle  build completed in 4.221sec
    2020-09-13T21:41:22.326Z [4567/13178] - info: [build]          requirejs modules  build completed in 4.272sec
    2020-09-13T21:41:23.276Z [4567/13178] - info: [build]         client side styles  build completed in 5.219sec
    2020-09-13T21:41:23.344Z [4567/13178] - info: [build] admin control panel styles  build completed in 5.287sec
    2020-09-13T21:41:23.663Z [4567/13178] - info: [build]                  languages  build completed in 5.605sec
    2020-09-13T21:41:25.024Z [4567/13178] - info: [build]                  templates  build completed in 6.967sec
    2020-09-13T21:41:25.025Z [4567/13178] - info: [build] Asset compilation successful. Completed in 6.971sec.
    
    

    ./nodebb dev looks clean too.

    ./nodebb dev
    
    NodeBB v1.13.4-5 Copyright (C) 2013-2014 NodeBB Inc.
    This program comes with ABSOLUTELY NO WARRANTY.
    This is free software, and you are welcome to redistribute it under certain conditions.
    For the full license, please visit: http://www.gnu.org/copyleft/gpl.html
    
    Clustering enabled: Spinning up 1 process(es).
    
    2020-09-13T21:45:46.338Z [4567/13514] - verbose: * using configuration stored in: /home/arek/Projekty/xab/nodebb/config.json
    2020-09-13T21:45:46.372Z [4567/13514] - info: Initializing NodeBB v1.13.4-5 http://192.168.0.15:4567
    2020-09-13T21:45:46.373Z [4567/13514] - verbose: * using mongo store at 127.0.0.1:27017
    2020-09-13T21:45:46.373Z [4567/13514] - verbose: * using themes stored in: /home/arek/Projekty/xab/nodebb/node_modules
    2020-09-13T21:45:47.148Z [4567/13514] - verbose: [minifier] utilizing a maximum of 5 additional threads
    (node:13514) ExperimentalWarning: Conditional exports is an experimental feature. This feature could change at any time
    2020-09-13T21:45:47.203Z [4567/13514] - verbose: Checking dependencies for outdated modules
    2020-09-13T21:45:47.464Z [4567/13514] - verbose: [notifications.init] Registering jobs.
    2020-09-13T21:45:47.465Z [4567/13514] - verbose: [user/jobs] (Re-)starting user jobs...
    2020-09-13T21:45:47.465Z [4567/13514] - verbose: [user/jobs] Starting job (digest.daily)
    2020-09-13T21:45:47.466Z [4567/13514] - verbose: [user/jobs] Starting job (digest.weekly)
    2020-09-13T21:45:47.467Z [4567/13514] - verbose: [user/jobs] Starting job (digest.monthly)
    2020-09-13T21:45:47.467Z [4567/13514] - verbose: [user/jobs] Starting job (reset.clean)
    2020-09-13T21:45:47.468Z [4567/13514] - verbose: [user/jobs] 4 jobs started
    2020-09-13T21:45:47.468Z [4567/13514] - verbose: [emailer] Setting up SMTP fallback transport
    2020-09-13T21:45:47.483Z [4567/13514] - verbose: [middleware/autoLocale] Retrieves languages list for middleware
    2020-09-13T21:45:47.499Z [4567/13514] - info: [themes] Using theme nodebb-theme-xayab2
    2020-09-13T21:45:47.499Z [4567/13514] - verbose: [plugins] Initializing plugins system
    2020-09-13T21:45:47.510Z [4567/13514] - verbose: [emailer] Built custom email templates
    2020-09-13T21:45:47.530Z [4567/13514] - verbose: [plugins] Loaded plugin: nodebb-plugin-composer-default
    2020-09-13T21:45:47.552Z [4567/13514] - verbose: [plugins] Loaded plugin: nodebb-plugin-markdown
    2020-09-13T21:45:47.582Z [4567/13514] - verbose: [plugins] Loaded plugin: nodebb-plugin-mentions
    2020-09-13T21:45:47.583Z [4567/13514] - verbose: [plugins] Loaded plugin: nodebb-widget-essentials
    2020-09-13T21:45:47.584Z [4567/13514] - verbose: [plugins] Loaded plugin: nodebb-rewards-essentials
    2020-09-13T21:45:47.585Z [4567/13514] - verbose: [plugins] Found 3 sound file(s) for plugin nodebb-plugin-soundpack-default
    2020-09-13T21:45:47.585Z [4567/13514] - verbose: [plugins] Loaded plugin: nodebb-plugin-soundpack-default
    2020-09-13T21:45:47.613Z [4567/13514] - verbose: [plugins] Loaded plugin: nodebb-plugin-emoji
    2020-09-13T21:45:47.619Z [4567/13514] - verbose: [plugins] Loaded plugin: nodebb-plugin-emoji-android
    2020-09-13T21:45:47.620Z [4567/13514] - verbose: [plugins] Loaded plugin: nodebb-theme-xayab2
    2020-09-13T21:45:47.644Z [4567/13514] - verbose: [plugins] Loaded plugin: nodebb-plugin-dbsearch
    
    2020-09-13T21:45:47.644Z [4567/13514] - warn: [plugins/load] The following plugins may not be compatible with your version of NodeBB. This may cause unintended behaviour or crashing. In the event of an unresponsive NodeBB caused by this plugin, run `./nodebb reset -p PLUGINNAME` to disable it.
      * nodebb-plugin-composer-default
      * nodebb-plugin-markdown
      * nodebb-plugin-mentions
      * nodebb-widget-essentials
      * nodebb-rewards-essentials
      * nodebb-plugin-soundpack-default
      * nodebb-plugin-emoji
      * nodebb-plugin-emoji-android
      * nodebb-theme-xayab2
      * nodebb-plugin-dbsearch
    
    2020-09-13T21:45:47.645Z [4567/13514] - verbose: [plugins/fireHook] filter:sanitize.config
    2020-09-13T21:45:47.646Z [4567/13514] - info: [plugins] Plugins OK
    2020-09-13T21:45:47.646Z [4567/13514] - verbose: [plugins/fireHook] static:assets.prepare
    2020-09-13T21:45:47.646Z [4567/13514] - verbose: [plugins/fireHook] static:app.preload
    2020-09-13T21:45:47.647Z [4567/13514] - verbose: [plugins/fireHook] static:app.load
    2020-09-13T21:45:47.666Z [4567/13514] - verbose: [plugins/fireHook] action:markdown.updateParserRules
    2020-09-13T21:45:47.671Z [4567/13514] - verbose: [emoji] Building emoji assets
    2020-09-13T21:45:47.671Z [4567/13514] - verbose: [plugins/fireHook] filter:emoji.packs
    2020-09-13T21:45:47.674Z [4567/13514] - verbose: [emoji] Loaded packs {"0":"a","1":"n","2":"d","3":"r","4":"o","5":"i","6":"d"}
    2020-09-13T21:45:47.687Z [4567/13514] - verbose: [plugins] All plugins reloaded and rerouted
    2020-09-13T21:45:47.687Z [4567/13514] - verbose: [plugins/fireHook] filter:auth.init
    2020-09-13T21:45:47.708Z [4567/13514] - info: Routes added
    2020-09-13T21:45:47.709Z [4567/13514] - verbose: [meta/blacklist] Loading 0 blacklist rule(s)
    2020-09-13T21:45:47.709Z [4567/13514] - verbose: [plugins/fireHook] filter:flags.getFilters
    2020-09-13T21:45:47.709Z [4567/13514] - info: NodeBB Ready
    2020-09-13T21:45:47.712Z [4567/13514] - verbose: [plugins/fireHook] action:nodebb.ready
    2020-09-13T21:45:47.713Z [4567/13514] - info: Enabling 'trust proxy'
    2020-09-13T21:45:47.714Z [4567/13514] - info: NodeBB is now listening on: 0.0.0.0:4567
    2020-09-13T21:45:48.136Z [4567/13514] - verbose: [plugins/fireHook] static:sockets.validateSession
    2020-09-13T21:45:49.104Z [4567/13514] - verbose: [plugins/fireHook] static:sockets.validateSession
    2020-09-13T21:45:49.105Z [4567/13514] - verbose: [plugins/fireHook] filter:topics.unreadCutoff
    2020-09-13T21:45:49.111Z [4567/13514] - verbose: [plugins/fireHook] filter:user.getSettings
    2020-09-13T21:45:49.111Z [4567/13514] - verbose: [plugins/fireHook] filter:user.notificationTypes
    2020-09-13T21:45:49.114Z [4567/13514] - verbose: [plugins/fireHook] filter:topics.getUnreadTids
    2020-09-13T21:45:50.132Z [4567/13514] - verbose: [plugins/fireHook] static:sockets.validateSession
    2020-09-13T21:45:50.141Z [4567/13514] - verbose: [plugins/fireHook] static:sockets.validateSession
    2020-09-13T21:45:50.141Z [4567/13514] - verbose: [plugins/fireHook] filter:topics.unreadCutoff
    2020-09-13T21:45:50.143Z [4567/13514] - verbose: [plugins/fireHook] filter:user.getSettings
    2020-09-13T21:45:50.143Z [4567/13514] - verbose: [plugins/fireHook] filter:user.notificationTypes
    2020-09-13T21:45:50.148Z [4567/13514] - verbose: [plugins/fireHook] filter:topics.getUnreadTids
    2020-09-13T21:45:50.172Z [4567/13514] - verbose: [plugins/fireHook] action:analytics.increment
    2020-09-13T21:45:51.111Z [4567/13514] - verbose: [plugins/fireHook] action:analytics.increment
    
    

    ./nodebb log

    arek@arekubuntu:~/Projekty/xab/nodebb$ ./nodebb log
    
    Hit Ctrl-C to exit
    
    
    2020-09-13T21:40:10.400Z [4567/13033] - info: NodeBB Ready
    2020-09-13T21:40:10.403Z [4567/13033] - info: Enabling 'trust proxy'
    2020-09-13T21:40:10.405Z [4567/13033] - info: NodeBB is now listening on: 0.0.0.0:4567
    (node:13067) ExperimentalWarning: Conditional exports is an experimental feature. This feature could change at any time
    2020-09-13T21:41:09.678Z [4567/13033] - info: [app] Shutdown (SIGTERM/SIGINT) Initialised.
    2020-09-13T21:41:09.680Z [4567/13033] - info: [app] Web server closed to connections.
    2020-09-13T21:41:09.680Z [4567/13033] - info: [app] Live analytics saved.
    2020-09-13T21:41:09.683Z [4567/13033] - info: [app] Database connection closed.
    2020-09-13T21:41:09.684Z [4567/13033] - info: [app] Shutdown complete.
    


  • Problem solved.

    https://community.nodebb.org/post/27942

    Topic to close.


  • Admin Staff

    Your initial header.tpl should work with the latest version of nodebb, app.template is no longer necessary since that is available in ajaxify.data.template


Log in to reply
 

Suggested Topics

  • 10
  • 7
  • 1
  • 3
  • 1
| |