The front-end js is encrypted with crypto, but the back-end node cannot be decrypted?

I want to encrypt the password on the front-end (vue) login page and send it to the backend (node) for decryption, but I reported an error.
I encrypted the password with the same key on the node side, and then I can decrypt it, which is different from the one encrypted by js. What is the reason for this?

// 
function aesEncrypt(data, key) {
    const cipher = crypto.createCipher("aes-256-ecb", key);
    cipher.setAutoPadding(true);
    var crypted = cipher.update(data, "utf8", "base64");
    crypted += cipher.final("base64");
    return crypted;
}
// 
function aesDecrypt(encrypted, key) {
    const decipher = crypto.createDecipher("aes-256-ecb", key);
    var decrypted = decipher.update(encrypted, "base64", "utf8");
    decrypted += decipher.final("utf8");
    return decrypted;
}

var data = "$admin123456";
var key = "n3JydWaRTRFa7wp7pF4PFbHHYmTrynpH";
var encrypted = aesEncrypt(data, key);
var decrypted = aesDecrypt(encrypted, key);
console.log("Encrypted text: " + encrypted);
console.log("Decrypted text: " + decrypted);

is that the wrong thing to write?

Aug.05,2021

aes also ECB , CBC . Many kinds, you can see aes encryption and decryption this site, also using crypto-js , it is divided into 5 kinds.
you can test and compare the results.

Menu