Uncaught TypeError: filesys.existsSync is not a function

风格不统一 提交于 2021-02-10 18:50:21

问题


When trying to initialize IOT device using AWS IoT SDK for JavaScript, its giving error

TypeError: filesys.existsSync is not a function

var device = AWSIoTData.device({
    keyPath: "././assets/certificate/xx",
    certPath: "././assets/certificate/xx",
    caPath: "././assets/certificate/xx",
    clientId: "xx",
    host: "xx",
    region: "xx",
    port: 8883,
    debug: true
});

How come tls-reader.js has this undefined function?


回答1:


If your trying to work with aws-iot-sdk with browser this will not work as expected. In your example your trying to access the certificates using path which is a functionality not available on browser runtime. FileSystem is a system module and it's not supported by a browser but supported by node. However you can use to "browserify" get this resolved. Refer to the sdk documentation for more information.



来源:https://stackoverflow.com/questions/55390719/uncaught-typeerror-filesys-existssync-is-not-a-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!