n8n/packages/cli/bin/n8n
कारतोफ्फेलस्क्रिप्ट™ b701dcb8ef
ci!: Drop support for Node.js 16. Add initial support for Node.js 20 (#6649)
We need to drop node 16 support, [as support for it is ends much earlier now, due to support for openssl 1.1.1 ending](https://nodejs.org/en/blog/announcements/nodejs16-eol).

`0.236.x` releases will continue to support Node.js 16 for another two months, and `1.x.x` releases will only support Node.js 18 for now.
2023-07-12 15:03:23 +02:00

43 lines
1.2 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 (![18, 20].includes(nodeVersionMajor)) {
console.log(`
Your Node.js version (${nodeVersion}) is currently not supported by n8n.
Please use Node.js v18 (recommended), or v20 instead!
`);
process.exit(1);
}
// Prevent oclif from loading ts-node and typescript
process.env.OCLIF_TS_NODE = '0';
require('express-async-errors');
require('source-map-support').install();
require('reflect-metadata');
require('@oclif/command')
.run()
.then(require('@oclif/command/flush'))
.catch(require('@oclif/errors/handle'));