Theme and stylesheet loading issues



  • I had to recover my system and now themes/stylesheets are not working properly.

    /stylesheet.css?v=v0.3.2-88-gcb98618

    is not found


  • GNU/Linux Admin

    recover my system

    System restore?

    Assuming you haven't modified any of the files in NodeBB, please back up your Redis database and run the following:

    git reset --hard HEAD
    git pull
    ./nodebb upgrade
    


  • I recovered but i had to go to v0.3.x branch or i got errors. everything works again except for the stylesheet.



  • warn: [plugins/nodebb-plugin-vimeo] staticDir is deprecated, define CSS files with new staticDirs instead.
    warn: [plugins/nodebb-plugin-soundcloud] staticDir is deprecated, use staticDirs instead
    warn: [plugins/nodebb-plugin-soundcloud] staticDir is deprecated, define CSS files with new staticDirs instead.
    warn: [plugins/nodebb-plugin-sso-facebook] staticDir is deprecated, use staticDirs instead
    warn: [plugins/nodebb-plugin-linkcheck] staticDir is deprecated, use staticDirs instead
    warn: [plugins/nodebb-plugin-linkcheck] staticDir is deprecated, define CSS files with new staticDirs instead.
    warn: [plugins/nodebb-theme-lavender] staticDir is deprecated, use staticDirs instead
    info: Enabling 'trust proxy'
    error: [app] Encountered Uncaught Exception: path must be a string
    TypeError: path must be a string
    at Object.fs.readdir (fs.js:649:11)
    at Object.Meta.themes.get (/home/ubuntu/community/src/meta.js:89:7)
    at /home/ubuntu/community/src/webserver.js:350:19
    at /home/ubuntu/community/node_modules/async/lib/async.js:511:21
    at /home/ubuntu/community/node_modules/async/lib/async.js:227:13
    at /home/ubuntu/community/node_modules/async/lib/async.js:111:13
    at Array.forEach (native)
    at _each (/home/ubuntu/community/node_modules/async/lib/async.js:32:24)
    at async.each (/home/ubuntu/community/node_modules/async/lib/async.js:110:9)
    at _asyncMap (/home/ubuntu/community/node_modules/async/lib/async.js:226:9)
    info: [app] Restarting...
    error: [app] Encountered Uncaught Exception: Arguments to path.join must be strings
    TypeError: Arguments to path.join must be strings
    at path.js:360:15
    at Array.filter (native)
    at Object.exports.join (path.js:358:36)
    at /home/ubuntu/community/src/webserver.js:314:53
    at /home/ubuntu/community/src/database/redis.js:266:4
    at try_callback (/home/ubuntu/community/node_modules/redis/index.js:532:9)
    at RedisClient.return_reply (/home/ubuntu/community/node_modules/redis/index.js:614:13)
    at HiredisReplyParser.<anonymous> (/home/ubuntu/community/node_modules/redis/index.js:266:14)
    at HiredisReplyParser.EventEmitter.emit (events.js:95:17)
    at HiredisReplyParser.execute (/home/ubuntu/community/node_modules/redis/lib/parser/hiredis.js:43:18)
    info: [app] Restarting...
    info: [app] Shutdown (SIGTERM/SIGINT) Initialised.
    info: [app] Database connection closed.
    info: [app] Goodbye!
    info: NodeBB v0.3.2 Copyright (C) 2013 DesignCreatePlay Inc.
    info: This program comes with ABSOLUTELY NO WARRANTY.
    info: This is free software, and you are welcome to redistribute it under certain conditions.
    info:
    info: NodeBB v0.3.2 Copyright (C) 2013 DesignCreatePlay Inc.
    info: This program comes with ABSOLUTELY NO WARRANTY.
    info: This is free software, and you are welcome to redistribute it under certain conditions.
    info:
    ^Cinfo: [app] Shutdown (SIGTERM/SIGINT) Initialised.
    info: [app] Shutdown (SIGTERM/SIGINT) Initialised.
    info: [app] Database connection closed.
    info: [app] Database connection closed.
    info: [app] Goodbye!
    info: [app] Goodbye!



  • error: [app] Encountered Uncaught Exception: Cannot read property 'categories' of undefined
    TypeError: Cannot read property 'categories' of undefined
    at /home/ubuntu/community/src/webserver.js:555:41
    at Command.callback (/home/ubuntu/community/src/categories.js:144:12)
    at RedisClient.return_error (/home/ubuntu/community/node_modules/redis/index.js:512:25)
    at HiredisReplyParser.<anonymous> (/home/ubuntu/community/node_modules/redis/index.js:263:14)
    at HiredisReplyParser.EventEmitter.emit (events.js:95:17)
    at HiredisReplyParser.execute (/home/ubuntu/community/node_modules/redis/lib/parser/hiredis.js:41:18)
    at RedisClient.on_data (/home/ubuntu/community/node_modules/redis/index.js:488:27)
    at Socket.<anonymous> (/home/ubuntu/community/node_modules/redis/index.js:82:14)
    at Socket.EventEmitter.emit (events.js:95:17)
    at Socket.<anonymous> (_stream_readable.js:746:14)



  • i believe categories got messed up in the database.



  • git reset --hard HEAD

    only v0.3.x works with categories - however the stylesheet.css is not loaded or found



  • @datz it is definitely the categories. any way i can refactor the categories to work from v0.3.x to the new master?



  • in our key store we have

    key values in the following formats:

    "categories:21:tid"

    "categories:recent_posts:cid:2"

    "categories:cid"

    "category:3"

    we see the following function return null/undefined:

    Categories.getAllCategories = function(uid, callback) {
                    db.getSortedSetRange('categories:cid', 0, -1, function(err, cids) {
                            if(err) {
                                    return callback(err);
                            }
    
                            if(cids && cids.length === 0) {
                                    return callback(null, {categories : []});
                            }
    
                        Categories.getCategories(cids, uid, callback);
                });
        };


  • ##Dumping categories:cid

    redis 127.0.0.1:6379[5]> dump categories:cid
    "\n>>\x00\x00\x00:\x00\x00\x00\x15\x00\x00\xf2\x02\xf3\x02\xf4\x02\xf5\x02\xf6\x02\xf7\x02\xf8\x02\xf9\x02\xfa\x02\xfb\x02\xfc\x02\xfd\x02\xfe\r\x03\xfe\x0e\x03\xfe\x0f\x03\xfe\x10\x03\xfe\x11\x03\xfe\x12\x03\xfe\x13\x03\xfe\x14\x03\xfe\x15\xff\x06\x00\xc5V7c\x9a\x06\x1d\xec"


  • What does zrange categories:cid 0 -1 say?



  • zrange categories:cid 0 -1

    @baris

    redis 127.0.0.1:6379[5]> zrange categories:cid 0 -1
    (error) ERR Operation against a key holding the wrong kind of value


  • any way to salvage this? lots of important data on here.



  • Looks like you didn't run the upgrade that updated categories to a sorted set then. Try updating to latest and then ./nodebb upgrade. Don't forget to make a backup of your database.



  • @baris yes i have the latest code and did a upgrade



  • silent error and death on upgrade

    info: NodeBB v0.3.2 Copyright (C) 2013 DesignCreatePlay Inc.
    info: This program comes with ABSOLUTELY NO WARRANTY.
    info: This is free software, and you are welcome to redistribute it under certain conditions.
    info:
    info: Time: Thu Feb 27 2014 06:16:11 GMT+0000 (UTC)
    info: Initializing NodeBB v0.3.2
    info: * using configuration stored in: /home/ubuntu/community/config.json
    info: * using redis store at 127.0.0.1:6379
    info: * using themes stored in: /home/ubuntu/community/node_modules
    warn: You have no redis password setup!
    info: Enabling 'trust proxy'
    warn: Your NodeBB schema is out-of-date. Please run the following command to bring your dataset up to spec:
    warn: node app --upgrade
    warn: To ignore this error (not recommended):
    warn: node app --no-check-schema



  • excuse me

    on upgrade

    info: [2014/2/20] Activating NodeBB Essential Widgets
    warn: [plugins/nodebb-plugin-youtube] staticDir is deprecated, use staticDirs instead
    warn: [plugins/nodebb-plugin-youtube] staticDir is deprecated, define CSS files with new staticDirs instead.
    warn: [plugins/nodebb-plugin-blog-comments] staticDir is deprecated, use staticDirs instead
    warn: [plugins/nodebb-widget-essentials] staticDir is deprecated, use staticDirs instead
    warn: [plugins/nodebb-widget-essentials] staticDir is deprecated, define CSS files with new staticDirs instead.
    warn: [plugins/nodebb-plugin-chat-emote] staticDir is deprecated, use staticDirs instead
    warn: [plugins/nodebb-plugin-chat-emote] staticDir is deprecated, define CSS files with new staticDirs instead.
    warn: [plugins/nodebb-plugin-sso-github] staticDir is deprecated, use staticDirs instead
    warn: [plugins/nodebb-plugin-imgur] staticDir is deprecated, use staticDirs instead
    warn: [plugins/nodebb-plugin-sso-google] staticDir is deprecated, use staticDirs instead
    warn: [plugins/nodebb-plugin-rss] staticDir is deprecated, use staticDirs instead
    warn: [plugins/nodebb-plugin-sso-twitter] staticDir is deprecated, use staticDirs instead
    warn: [plugins/nodebb-plugin-emoji-skype] staticDir is deprecated, use staticDirs instead
    warn: [plugins/nodebb-plugin-emoji-skype] staticDir is deprecated, define CSS files with new staticDirs instead.
    warn: [plugins/nodebb-plugin-cash] staticDir is deprecated, use staticDirs instead
    warn: [plugins/nodebb-plugin-cash] staticDir is deprecated, define CSS files with new staticDirs instead.
    warn: [plugins/nodebb-plugin-vimeo] staticDir is deprecated, use staticDirs instead
    warn: [plugins/nodebb-plugin-vimeo] staticDir is deprecated, define CSS files with new staticDirs instead.
    info: Enabling 'trust proxy'
    error: [app] Encountered Uncaught Exception: path must be a string
    TypeError: path must be a string
    at Object.fs.readdir (fs.js:649:11)
    at Object.Meta.themes.get (/home/ubuntu/community/src/meta.js:89:7)
    at /home/ubuntu/community/src/webserver.js:350:19
    at /home/ubuntu/community/node_modules/async/lib/async.js:505:21
    at /home/ubuntu/community/node_modules/async/lib/async.js:221:13
    at /home/ubuntu/community/node_modules/async/lib/async.js:105:13
    at Array.forEach (native)
    at _each (/home/ubuntu/community/node_modules/async/lib/async.js:32:24)
    at async.each (/home/ubuntu/community/node_modules/async/lib/async.js:104:9)
    at _asyncMap (/home/ubuntu/community/node_modules/async/lib/async.js:220:9)
    error: [app] Could not restart server. Shutting down.
    info: [app] Shutdown (SIGTERM/SIGINT) Initialised.
    info: [app] Database connection closed.
    info: [app] Goodbye!



  • error: [app] Encountered Uncaught Exception: path must be a string



  • ###themePath not a string? or file names not string? possible hidden files .file?
    fs.readdir(themePath, function (err, files) {
    async.filter(files, function (file, next) {
    fs.stat(path.join(themePath, file), function (err, fileStat) {
    if (err) {
    return next(false);
    }

                                                next((fileStat.isDirectory() && file.slice(0, 13) === 'nodebb-theme-'));
                                        });
                                }, function (themes) {
                                        async.map(themes, function (theme, next) {
                                                var config = path.join(themePath, theme, 'theme.json');
    
                                                if (fs.existsSync(config)) {
                                                        fs.readFile(config, function (err, file) {
                                                                if (err) return next();
                                                                else {
                                                                        var configObj = JSON.parse(file.toString());
                                                                        next(err, configObj);
                                                                }
                                                        });
                                                } else {
                                                        next();
                                                }
                                        }, function (err, themes) {
                                                themes = themes.filter(function (theme) {
                                                        return (theme !== undefined);
                                                });
                                                callback(null, themes);
                                        });
                                });
                        });


  • https://github.com/designcreateplay/NodeBB/blob/master/src/meta.js#L88 can you add console.log(themePath); on that line and let me know the result?


Log in to reply
 

Suggested Topics

  • 3
  • 2
  • 3
  • 7
  • 6
| |