WARNING: Module "./lib/WebSocket" not found

Posted on
  • I reiceve the errors in photo i don't know why because in http://www.espruino.com/modules there is a ws library.
    I use a nodemcu dev kit board.
    Thanks in advance


    1 Attachment

    • errore.PNG
  • Not sure about error but in short term you can require the module directly using a path to it's URI on espruino.com (or anywhere else), or download it and require it from disk.

    First approach v.simple:

    var WebSocket = require("http://www.espruino.com/modules/ws.min.js")
    
  • It looks like you have a local file called ws.js or ws.min.js and that is getting loaded rather than the espurino module. Did you make a project and put a ws file in the module folder?

  • Thank you now it work, i require all the path. So i can use also all node js library?

  • I think you could have enabled 'Load modules from NPM (BETA)' in settings?

    Without that, it will probably work fine. You generally don't want to use Node JS libraries as they pull in loads of dependencies which eat up all your memory before you get started!

  • ok, but now i have another problem with websocket. I don't know why when i try to connect with my nodejs server this call everytime the event 'connection closed'


    2 Attachments

    • errnode.png
    • weberr.png
  • Please don't post the same question twice in two threads - I've just deleted the previous post you made and left this one.

  • You have an old version of Espruino on your ESP8266 (and the wrong version for the flash chip you're using). I'd suggest flashing @tve's latest version - and make sure to select the correct version for the size flash chip that your ESP8266 has.

    I think at least one of the people who's active on the gitter channel has used websockets on the ESP8266 and might be able to point you in the right direction. I'd try that - a lot of the ESP8266 people use the gitter channel.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

WARNING: Module "./lib/WebSocket" not found

Posted by Avatar for Lorè @Lorè

Actions