Cannot find module 'crypto-js' solution when python calls js file encryption

First install node.js
and remember to install node.js in the directory of your python code file. Although it is a bit messy, it is not easy to cause other problems. Secondly

   function encrypt(e) {
    
    
        const CryptoJS = require('crypto-js');
        // const CryptoJS = require('crypto-js');这一行记得加上去,因为有些代码块需要这个东西加密,每个要调用的函数里面都加上去
    var b = "bGVhcm5zcGFjZWFlczEyMw==";
    var a = new Base64();
    var c = a.decode(b);
    var f = CryptoJS.enc.Utf8.parse(c);

Then decompress the compressed package in the link https://wwor.lanzoue.com/iE5Is0ixp9ef directly into the node_modules of your code file, this ghost thing is in the directory where your node.js is installed

Guess you like

Origin blog.csdn.net/weixin_51064701/article/details/128359337