From 57696b22f41c57dd2bddf9f020fcd133cb8c2e76 Mon Sep 17 00:00:00 2001
From: Peter Jaszkowiak
Date: Thu, 30 Mar 2017 03:17:45 -0600
Subject: [PATCH] Partial fix #5538
---
src/database/mongo.js | 2 +-
src/reset.js | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/database/mongo.js b/src/database/mongo.js
index c62a22d352..91b41306f1 100644
--- a/src/database/mongo.js
+++ b/src/database/mongo.js
@@ -166,7 +166,7 @@
};
module.checkCompatibility = function (callback) {
- var mongoPkg = require.main.require('./node_modules/mongodb/package.json');
+ var mongoPkg = require('mongodb/package.json');
if (semver.lt(mongoPkg.version, '2.0.0')) {
return callback(new Error('The `mongodb` package is out-of-date, please run `./nodebb setup` again.'));
diff --git a/src/reset.js b/src/reset.js
index f709c4188b..c3bac3bbbb 100644
--- a/src/reset.js
+++ b/src/reset.js
@@ -1,5 +1,6 @@
'use strict';
+var path = require('path');
var winston = require('winston');
var nconf = require('nconf');
var async = require('async');
@@ -83,7 +84,7 @@ function resetTheme(themeId, callback) {
var meta = require('./meta');
var fs = require('fs');
- fs.access('node_modules/' + themeId + '/package.json', function (err) {
+ fs.access(path.join(__dirname, '../node_modules', themeId, 'package.json'), function (err) {
if (err) {
winston.warn('[reset] Theme `%s` is not installed on this forum', themeId);
callback(new Error('theme-not-found'));