You can use this line:
let test = crypto.createHmac('sha256', "key").update("json").digest("base64");
Convert to base64 last.
If you want to use a HMAC then you need to use the method crypto.createHmac(algorithm, key).
crypto.createHmac(algorithm, key)
I'm still missing the salt in node.js
It seems that you do not use the salt in your Java code...