Module "crypto" not found when using was module #5911
Replies: 1 comment
-
Posted at 2018-04-04 by @gfwilliams What board are you trying to run this on, and is the firmware up to date? Posted at 2018-04-04 by user88503 Its the original espruino board, with firmware v96 and v95 not working. Haven't tried older versions yet. Posted at 2018-04-05 by @gfwilliams Ahh. Unfortunately I don't think the Original Espruino Board ever had enough free flash memory to be able to include the crypto module by default (it's not JS, it's a built-in C module) @wilberforce made a JS version with just the function that's needed for websockets though: http://forum.espruino.com/conversations/276175/?offset=25#12817146 If you add the following at the top of your code:
Then that should fix it for you. Posted at 2018-04-05 by Wilberforce @gfwilliams Posted at 2018-04-05 by @gfwilliams It looks like it's still a bit tight on the Espruino board. It would just fit though, but probably not enough for the next release. Looking at it, the ESP8266 version still includes SHA224/256/384/512 as well - so realistically I could drop those and it'd leave enough room. I'll try and do that in the next few weeks. Posted at 2018-04-05 by Wilberforce I see hashlib is still there - does that take much space? https://github.com/espruino/Espruino/blob/master/boards/ESPRUINOBOARD.py#L38 I suppose people might be using that too! Posted at 2018-04-05 by user88503 @gfwilliams thanks so much!!! I really needed this. I will try it later today and see if it works. Posted at 2018-04-06 by user88503 It worked, but not with the modules.addCached. I had to modify the websockets module to just use
Instead of
Thanks a lot! Posted at 2018-04-09 by @gfwilliams Thanks for the update! Strange about the module though - it seems to work fine here. Could you have been trying it with an older firmware version? Posted at 2018-04-09 by user88503 No, I was using the latest version. I might have messed something else up though. Thanks for the help! Posted at 2018-04-10 by @gfwilliams Ahh, sorry - I think the issue is the WebSockets library was requesting the crypto library at load time rather than when it was needed. I'll tweak it so that next time I do an update that'll be sorted - but at least you have a modified version working! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2018-04-04 by user88503
Whenever I require("ws") it gives an error saying module crypto not found. I have tried loading the crypto module from node into a SD card under node_modules, but it still doesn't work.
Beta Was this translation helpful? Give feedback.
All reactions