微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

指纹js指纹.get不是一个函数

如何解决指纹js指纹.get不是一个函数

目前我在之前的项目中遇到了指纹问题,我是这样解决的:

 const test = async (req,res,next) => {
    // other code   
    
    const FingerprintJS = require('@fingerprintjs/fingerprintjs');
    const store = require('store')

    FingerprintJS.get({
      preprocessor: function(key,value) {
          return value
      }
    },function(components){
        let values = components.map(function (component) { return component.value });
        let device_id = FingerprintJS.x64hash128(values.join(''),31);
        store.set('print',{ device: device_id })
    });

    await new Promise(resolve => setTimeout(resolve,1000));
    
    // other code
    
  };

但现在我无法将它设置为工作..我在 console.log 中收到错误

(node:4940) UnhandledPromiseRejectionWarning: TypeError: FingerprintJS.get is not a function
    at login (C:\Users\PC06\Desktop\project\backend\controllers\clients-controllers.js:53:17)
(node:4940) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block,or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection,use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:4940) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future,promise rejections that are not handled will terminate the Node.js process with a
non-zero exit code.

对此有什么帮助吗?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。