2019-08-28 06:28:47 -07:00
#!/usr/bin/env node
2021-06-23 02:20:07 -07:00
2022-07-24 08:25:01 -07:00
var path = require('path');
2019-08-28 06:28:47 -07:00
// Make sure that it also find the config folder when it
// did get started from another folder that the root one.
process.env.NODE_CONFIG_DIR = process.env.NODE_CONFIG_DIR || path.join(__dirname, 'config');
// Check if version should be displayed
2022-07-24 08:25:01 -07:00
var versionFlags = [
2019-08-28 06:28:47 -07:00
'-v',
'-V',
2020-10-24 05:37:45 -07:00
'--version',
2019-08-28 06:28:47 -07:00
];
if (versionFlags.includes(process.argv.slice(-1)[0])) {
console.log(require('../package').version);
process.exit(0);
}
if (process.argv.length === 2) {
// When no command is given choose by default start
process.argv.push('start');
}
2020-10-25 03:26:27 -07:00
var nodeVersion = process.versions.node.split('.');
2020-10-25 03:01:36 -07:00
2021-05-03 14:15:02 -07:00
if (parseInt(nodeVersion[0], 10) < 14) {
2022-02-04 10:13:26 -08:00
console.log(`\nYour Node.js version (${process.versions.node}) is too old to run n8n.\nPlease update at least to Node.js v14 or to the recommended Node.js v16!\n`);
2021-12-11 08:41:18 -08:00
process.exit(1);
2019-10-23 05:03:40 -07:00
}
2019-08-28 06:28:47 -07:00
require('@oclif/command').run()
.then(require('@oclif/command/flush'))
.catch(require('@oclif/errors/handle'));