mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-01 05:10:42 +01:00
added logic to catch bad installs
In cases where the nodebb executable is run before `npm i`, NodeBB will now emit a friendly message instead of a scary one.
This commit is contained in:
29
nodebb
29
nodebb
@@ -1,14 +1,25 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var colors = require('colors'),
|
||||
cproc = require('child_process'),
|
||||
argv = require('minimist')(process.argv.slice(2)),
|
||||
fs = require('fs'),
|
||||
path = require('path'),
|
||||
request = require('request'),
|
||||
semver = require('semver'),
|
||||
prompt = require('prompt'),
|
||||
async = require('async');
|
||||
try {
|
||||
var colors = require('colors'),
|
||||
cproc = require('child_process'),
|
||||
argv = require('minimist')(process.argv.slice(2)),
|
||||
fs = require('fs'),
|
||||
path = require('path'),
|
||||
request = require('request'),
|
||||
semver = require('semver'),
|
||||
prompt = require('prompt'),
|
||||
async = require('async');
|
||||
} catch (e) {
|
||||
if (e.code === 'MODULE_NOT_FOUND') {
|
||||
process.stdout.write('NodeBB could not be started because it\'s dependencies have not been installed.\n');
|
||||
process.stdout.write('Please ensure that you have executed "npm install --production" prior to running NodeBB.\n\n');
|
||||
process.stdout.write('For more information, please see: https://docs.nodebb.org/en/latest/installing/os.html\n\n');
|
||||
process.stdout.write('Could not start: ' + e.code + '\n');
|
||||
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
var getRunningPid = function(callback) {
|
||||
fs.readFile(__dirname + '/pidfile', {
|
||||
|
||||
Reference in New Issue
Block a user