1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

if possible - force ipv4 name resolution to have priority

to fix Issue #4010
and others (eg) email node server connect fails, and some reported on SO
This commit is contained in:
Dave Conway-Jones 2023-01-23 13:02:58 +00:00
parent 928131cf08
commit d2c9f12c3a
No known key found for this signature in database
GPG Key ID: 88BA2B8A411BE9FF

View File

@ -25,9 +25,15 @@ var api = require("@node-red/editor-api");
var server = null; var server = null;
var apiEnabled = false; var apiEnabled = false;
const NODE_MAJOR_VERSION = process.versions.node.split('.')[0];
if (NODE_MAJOR_VERSION > 14) {
const dns = require('node:dns');
dns.setDefaultResultOrder('ipv4first');
}
function checkVersion(userSettings) { function checkVersion(userSettings) {
var semver = require('semver'); var semver = require('semver');
if (!semver.satisfies(process.version,">=8.9.0")) { if (!semver.satisfies(process.version,">=12.0.0")) {
// TODO: in the future, make this a hard error. // TODO: in the future, make this a hard error.
// var e = new Error("Unsupported version of Node.js"); // var e = new Error("Unsupported version of Node.js");
// e.code = "unsupported_version"; // e.code = "unsupported_version";