Node says that cluster.isMaster
is deprecated and we should use cluster.isPrimary
. But, while isMaster
is returning me true without problem, I getting undefined
when I try cluster.isPrimary
:
const cluster = require("cluster");
console.log(cluster.isPrimary); /// undefined
console.log(cluster.isMaster); /// true
Why is this happening?
CodePudding user response:
Make sure you are on at least Node version 16.0.0
you can see this by running this command in your terminal:
node --version