mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-26 21:19:43 -08:00
1a6f7a1e0d
Prevent oclif from loading ts-node and typescript
41 lines
1.1 KiB
JavaScript
Executable file
41 lines
1.1 KiB
JavaScript
Executable file
#!/usr/bin/env node
|
|
|
|
const path = require('path');
|
|
|
|
// 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
|
|
const versionFlags = ['-v', '-V', '--version'];
|
|
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');
|
|
}
|
|
|
|
const nodeVersion = process.versions.node;
|
|
const nodeVersionMajor = require('semver').major(nodeVersion);
|
|
|
|
if (![14, 16, 18].includes(nodeVersionMajor)) {
|
|
console.log(`
|
|
Your Node.js version (${nodeVersion}) is currently not supported by n8n.
|
|
Please use Node.js v14, v16 (recommended), or v18 instead!
|
|
`);
|
|
process.exit(1);
|
|
}
|
|
|
|
// Prevent oclif from loading ts-node and typescript
|
|
process.env.OCLIF_TS_NODE = '0';
|
|
|
|
require('source-map-support').install();
|
|
|
|
require('@oclif/command')
|
|
.run()
|
|
.then(require('@oclif/command/flush'))
|
|
.catch(require('@oclif/errors/handle'));
|