bah*_*379 5 multithreading cluster-computing child-process node.js node-cluster
Node 说它cluster.isMaster已被弃用,我们应该使用cluster.isPrimary. 但是,虽然isMaster毫无问题地返回我 true,但当我undefined尝试时我得到cluster.isPrimary:
const cluster = require("cluster");
console.log(cluster.isPrimary); /// undefined
console.log(cluster.isMaster); /// true
Run Code Online (Sandbox Code Playgroud)
为什么会发生这种情况?
确保您的 Node 版本至少为 16.0.0
您可以通过在终端中运行以下命令来看到这一点:
node --version
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3198 次 |
| 最近记录: |