• Sun 2018.09.09

    Commented on in a separate link but burried by title, so relisted here for more current visibility.

    native IDE v 0.68.6

    From: https://www.espruino.com/Modules

    If you are using a local project folder, the Web IDE will automatically create an empty modules folder inside. Put a module there and you can load it with require("myCustomModule");.
    With default Web IDE configuration, it will look for modules following this order:
    local minified
    online minified
    local normal
    online normal

    Located the default projects file newProject.js and verified the module file was in an adjacent sister folder.

    Ran the app but was greeted with: Module testLED not found

    The console output appears to agree that the modules folder isn't being searched.

    FIRMWARE: Current 1v99, Available 1v99
    Device found (connectionId=1)
    [success] Connected to port COM4
    >>> Connected to port COM4
    loadModule(testLED)
    ERROR: Found module, but search took too long.
    Espruino.Core.Utils.getURL: got HTTP status code 404 for http://www.espruino.com/modules/testLED.­min.js
    Espruino.Core.Utils.getURL: got HTTP status code 404 for http://www.espruino.com/modules/testLED.­js
    WARNING: [notify_warn] Module testLED not found
    Found a prompt... great!
    Splitting at "reset();\n", delay 250
    loadModule(testLED)
    ERROR: Found module, but search took too long.
    Espruino.Core.Utils.getURL: got HTTP status code 404 for http://www.espruino.com/modules/testLED.­min.js
    Espruino.Core.Utils.getURL: got HTTP status code 404 for http://www.espruino.com/modules/testLED.­js
    WARNING: [notify_warn] Module testLED not found
    Found a prompt... great!
    Splitting at "reset();\n", delay 250
    

    I also found this reference form Mar 2018 with similar situation and apparent attempt to resolve. Does this need a revisit?

    http://forum.espruino.com/comments/14110­348/

    WinXP: how can I require() some locally held modules?

    https://github.com/espruino/EspruinoWebI­DE/issues/186

  • @Robin, it looks like your sandbox is not really set... because it goes obviously only for remote... I know that in Win (and depending on settings on Mac) upper/lower may or may not matter... so checking for casing is good. It matters where you store the modules, but only relative to the setting of the sandbox. If the IDE settings for sandbox is

    C:\esp\_sbx

    then the modules folder has to be at

    C:\esp\_sbx\modules

    In other words, modules locally are always found in modules folder in sandbox folder, and of course, the module has to have an extension that shows in the list in the settings. That your module is not found at espruino.com/modules - hence the 404 - is obvious, but that it does then not find it in local - assuming the settings are correct and match the directory path of the modules - is not known to me...

    Btw, I'm not sure about forwards slash (/) and backward slash - backslash () for modules separator...

    What are your settings of:

    • COMMUNICATIONS
      • Module URL
      • Module Extensions
    • PROJECT
      • Sandbox directory

    What is your internet connection? - mobile (Phone Data, G?) or other?

    What is your sandbox folder hierarchy?

    What is running on your Win machine while you are uploading?

    What kind of firewall / antivirus / protection do you have running on your machine?

    What is the accesscontrol of the sandbox and its contained modules folder?

    @Gordon, is there a way to dump the Espruino IDE config as a JSON string?

  • Mon 2018.09.10

    @allObjects, I verified the placement of the \modules folder and that your testLED.js file was there.

    Install defaults for sandbox location:

    C:\Users\Robin\Documents\2017\Espruino_s­bx
    C:\Users\Robin\Documents\2017\Espruino_s­bx\modules
    C:\Users\Robin\Documents\2017\Espruino_s­bx\projects

    Note: That this forum post page omits the backslash before the '_sbx' folder and in 'projects' folder below - it's there in both places, just checked

    As per the Modules page ref #1 above, There is also a child modules folder

    C:\Users\Robin\Documents\2017\Espruino_s­bx\projects\modules

    and yes, placed a copy of the file there also.


    The install defaults for Settings >> Communication:

    http://www.espruino.com/modules
    .min.js|.js
    ~\Documents\2017\Espruino_sbx\projects

    backslash is before '_sbx' also

    I have administrator rights set for the access control, so that shouldn't be an issue
    Avast for antivirus
    Hardwired modem

    Gordon indicated he was on Holiday this week so, we'll wait to see whether the config can be dumped before I tackle more.

  • Hi @Robin

    This what is working under windows 10 for me: (native Web IDE version 0.69.0)

    Settings->Project
    F:\OneDrive\brubonic\www
    [Select Directory for Sandbox]

     Directory of F:\OneDrive\brubonic\www\modules
    
    31/12/2017  06:56 PM             4,088 DS18B20.js
    22/08/2017  04:09 PM             1,934 pid-controller.js
    22/07/2018  04:45 PM             8,553 ws.js
    28/06/2018  10:06 PM             2,288 http://www.js
    

    code:

    var PID = require('pid-controller');
    var WWW = require('www');
    

    And on send :

    Connected to port TCP/IP: 192.168.15.13
    No error. Minified 1934 bytes to 1758 bytes.
    No error. Minified 2288 bytes to 1155 bytes.
    No error. Minified 4086 bytes to 1472 bytes.
    No error. Minified 8553 bytes to 3893 bytes.
    

    I have noted on startup of the ide that sometimes do you need set the project sandbox on startup, as this seems to get forgotten and needs to be re-selected.

    Looking at the settings->Console

    These are at the relevant bits I see:

    Loading http://www.espruino.com/json/ESP32.json
    Board JSON loaded
    Firmware >1.43 supports faster writes over USB
    Set Slow Write = false
    FIRMWARE: Current 1v99.166, Available 1v99
    Device found (connectionId=undefined)
    [success] Connected to port TCP/IP: 192.168.15.13
    >>> Connected to port TCP/IP: 192.168.15.13
     - pid-controller requires []
    [notify_info] No error. Minified 1934 bytes to 1758 bytes.
     - www requires []
    [notify_info] No error. Minified 2288 bytes to 1155 bytes.
     - DS18B20 requires []
    [notify_info] No error. Minified 4086 bytes to 1472 bytes.
     - ws requires []
    [notify_info] No error. Minified 8553 bytes to 3893 bytes.
    Uploading 11848 bytes to flash
    Found a prompt... great!
    >>> Sending...
    
  • @Robin, the sequence of backslash has a special meaning to the forum... and therefore does not show. I got it rendered by placing two (2) backslashes in... ;-)

  • Tue 2018.09.11

    Thank you @Wilberforce, the extra set of eyes helps. Along with the folder hierarchy confirmation.


    'the sequence of backslash have a special meaning'

    @allObjects, found that tidbit

    'Markdown provides backslash escapes for the following characters:'
    _ underscore

    IMHO: then having default folders with leading underscore is not only confusing in file structure to the end user, this forum machine also struggles. So why not eliminate it in future releases? (Unless of course Mac's use that convention)



    While pouring over many console logs over the last three days . . . .

    and, . . . this will explain it all . . . .

    Review line #5#6 of console output from #1 above.

    Go on, . . . I'll wait while you take a peek . . . .

    Got it? You did look didn't you? . . . go on scroll up, . . . I'll wait

    I said this would explain it. So here goes . . .




    Monty Python's Ministry of Module Retrieval Sketch

    John Cleese as barister - flowing robe and wig
    Eric Idle as madame - long dress with clutch purse

    okay, let me get the accent right . . .

    lights, camera, and . . . action

    JC: How may I help you madame?
    EI: Have you found my missing module?

    JC: Yes, yes we have.
    EI: Well, where is it then?

    JC: We've run into a bit of a snafu, you see . . .
    EI: Well you did find my module, . . . didn't you?
    JC: Precisely. [elbows down, hands raised, thumbs inside robe - stirn tone]

    EI: Well, where is it?
    JC: Where is what?
    EI: My module!!

    JC: You see madame, it took a bit longer than expected, 250msec to be exact!!
    EI: So??

    JC: We don't handle that. [long dramatic pause]

    EI: What, you don't handle bringing me, my module you found?
    JC: Exactly, . . . You see, we only locate what you seek. On top of that, it took just a teensy-weensy bit too long. [pause]
    You need to contact the Ministry of Module Retrieval, . . . this is the Ministry of Module Location!



    run laughter track

    curtains close, Liberty Bell music sounds in background . . . and cut! That's a wrap!!

    So, surprisingly we all missed it! While looking for folder mapping concerns, the answer was there right in front of us.

  • 404 is totally correct... it could not find it locally and so it looked remote, and there - espruino.com - it could find it. If local was emulated with something else that is not able to deliver a handful bytes within 250ms something else in the system setup is amiss.

    In some environments that are slow to connect, connecting first before hitting the upload button does the trick... even though upload can connect on demand... but the timeout then obviously hits... @Gordon mentioned more recent somewhere - if I'm remembering correctly - that (module?) upload(?) code is (was?) a bit iffy and would need (some) rewrite...

    IMHO: then having default folders with leading underscore is not only confusing in file structure to the end user, this forum machine also struggles. So why not eliminate it in future releases? (Unless of course Mac's use that convention)

    This is only because using the same set of terminals for different purposes... or mixing two langages - one content and the other rendering - that use the same set of symbols... to avoid people having to use real markup... in a plain-text editor (basics of (markup) language design / compiler/interpreter construction). So saving in one corner with a cheap markup is will make paying in a corner somewhere else...

    On the other hand, not only what's going on in this forum but also on all wiki pages and even in yaml files, it can work and is a great relieve over known constructs, such JSON, HTML, and even more so for the dead XHTML and the still vividly alive XML. XML (w/ schemas and other supporting mechanisms will not go away, because that is the ultimate solution to prevent misunderstandings / mixups, or in other words, be as clear and precise as possible to communicate what has to communicated).

    When entering the paths, I right away noticed that something was fishy and I doubted first myself that I missed the backslash... but that was quickly verified and resolved. Another reason why it is perfectly acceptable to use this simple, same symbols markup without reserved begin and end character, the forum already provides inline and in block escape - shift in a different rendering mode and shift out again - with beginning and ending tripple-back-ticks... the way we show and share /copy-paste to and from code blocks, where we for sure cannot accept character swallowing... (only one little problem: using this forum for python multi-line string... luckily, JavaScript picked the single back tick for that and is safe ;-)

  • So what machine/OS are you actually using the Espruino IDE on?

    Just a bit of background - the current project sandbox code calls into Chrome to try and find the file on the disc. If the file doesn't exist then it never actually gets a callback, so it has a timeout instead to figure out if the file is missing. If that timeout is raised, it slows down the upload of all modules that aren't on the hard disk for every user so it's a tradeoff.

    I had (perhaps wrongly) assumed that a computer from the last 10 years might be able to retrieve a file from the hard disk in under a quarter of a second given mine seem to manage it in a few thousandths of a second, but obviously that was too optimistic. Perhaps you have a virus checker enabled that's drastically slowing file accesses down?

  • Wed 2018.09.12

    re: '404 is totally correct... it could not find it locally and so it looked remote, and there - espruino.com - it could find it.'

    As I read the following:

    FIRMWARE: Current 1v99, Available 1v99
    Device found (connectionId=1)
    [success] Connected to port COM4
    >>> Connected to port COM4
    loadModule(testLED)
    ERROR: Found module, but search took too long.
    Espruino.Core.Utils.getURL: got HTTP status code 404 for http://www.espruino.com/modules/testLED.­min.js
    

    Line 5 Is the request to load the module named 'testLED'
    Line 6 Is an error msg response indicating 'Found Module'
    Line 7 Is an Http 404 status code for the unfound minified file at espruino.com (which is accurate as I never placed it there)

    So, I disagree with the assessment the local file could not be found as the error log shows.


    For @Gordon

    'So what machine/OS are you actually using the Espruino IDE on?'

    The same as always, I only have one, a recent HP Notebook laptop running Windows 10

  • Perhaps a solution would be here at this point, as well as setting the found flag, clear the timer?

    https://github.com/espruino/EspruinoWebI­DE/blob/e974a3c1a0fbe66bdc732886fe11fc54­63710d3f/js/plugins/project.js#L52

  • Browsed the code and noticed this line

              // if more than 100 entries, chrome will limit it
    

    in (private) function getModules(subDirEntry){....

    How does the IDE user experience this limit?

    For, example, if the directory has more than 100 entries, will only the first 100 be considered / processed / shown?

  • @Robin did you try disabling the virus checker and seeing if that helps?

    So, I disagree with the assessment the local file could not be found as the error log shows.

    As I said in the post (and it says in the console log), the file does exist - it's the time taken to access the file that is the issue.

    Perhaps a solution would be here at this point, as well as setting the found flag, clear the timer?

    Yes - personally it seems to me like that code could be improved a lot though. For instance in that function it should know if a file isn't found. If that is the case then potentially the timeout could be removed completely.

    if the directory has more than 100 entries, will only the first 100 be considered / processed / shown?

    No - because that extra line of code by the comment reads the next 100, and so on.

  • that extra line of code reads the next 100, and so on.

    @Gordon, good to get confirmed... did actually not expect to find a limitation in the code with no mentioning in any of the documentation. I'm not sure I ever had 100+ files in one of the directories, but a lot for sure.

  • Tue 2018.09.18

    @Robin did you try disabling the virus checker and seeing if that helps?

    Yes. Disabled Avast and ran the test again, but had the same output as above #9

  • Sat 2018.10.06

    Recently installed the new IDE 0.70.4 and thought I'd give this another try, but now in a separate new folder in the root of the drive, to avoid folder inheritance issues.

    I'm on the same laptop PC with no SD card feature, so am puzzled by yet a new error:

    1v99 (c) 2018 G.Williams
    >Uncaught Error: Module testLED.js not found
     at line 1 col 33
    ...estLED=require("testLED.js").create()­;var iId=null;function ...
                                  ^
    =undefined
    >echo(0);
    Uncaught Error: SD card must be setup with E.connectSDCard first
     at line 1 col 60
    ...k("node_modules/testLED.js");fs.write­File("node_modules/test...
                                  ^
    Uncaught Error: SD card must be setup with E.connectSDCard first
     at line 1 col 43
    fs.appendFile("node_modules/testLED.js",­"");
                                              ^
    =undefined
    

    Even more puzzling, I didn't create, nor is there when using the 'Projects' button,
    a folder named 'node_modules/'

    re #4: 'I have noted on startup of the ide that sometimes do you need set the project sandbox on startup'

    Not had to do this after checking each time is still intact on IDE start.

  • Sun 2018.10.07

    Restarting and recreating a new folder in the HD root, away from the Windows 'Documents' folder, . . . . and . . . .

    After realizing that deployed to GitHub modules require the filename, local folders require just the module name.

    Finally was able to read a local module!

    It is the 'tilde' that precedes the relative folder path that needs attention when selecting the folder for the sandbox.

    What the IDE doesn't do well is when creating a folder within the 'Projects' folder to store multiple files related to the same project, locating that module. So maybe relative pathing needs review?

    Also, when I deleted the module, the IDE still ran as if the module was still present. So a caching issue or Windows? Rebooting solved that.

  • Ok, glad you got it working.

    Where was the tilde you mentioned? In the require statement? Espruino does only expect that you use individual filenames, not paths - so that could be the issue I guess.

    Uncaught Error: SD card must be setup with E.connectSDCard first
     at line 1 col 60
    ...k("node_modules/testLED.js");fs.write­File("node_modules/test...
    

    This is coming from Espruino itself. By the look of the use of fs in the code dump, you're using the filesystem library for something in your code. Espruino's telling you quite rightly that if you want to use a FAT32 filesystem you need to connect an SD card.

  • *This post needs some more EDIT - so take it with a pinch of salt, because it does not include all the aspects a sandbox serves... :( * - aka: ...if I would have more time, I would have written a shorter letter (post)...

    @Robin, indeed, I would like to have stronger code / library organization options, like projects would include subfolder - for each project one - and - related to that project - a folder just for the project specific modules. The general modules folder would always be available.

    But last sentence in previous paragraph kind-a invalidates the first one, because it becomes a never ending rabbit trail: when do you decide a module becomes generally available or stays within a project specific modules folder...

    After all the, the IDE is a free-be, to make things easy. For me it boils down to a sandbox per real project, that gives the extra level to have project specifics going very well, since the sandbox name can be chosen.

    What I'm now missing with this sandbox being a project, where can I put modules across my projects? My answer is: if they are of that sort, grow them to general purpose AND general PUBLIC use, make a merge request and they are in the espruino.com/modules folder on the Web for the BENEFIT of ALL.

    If that is too course granular, yes, a local extra configurable folder for shared folders folders across sandboxes would be the perfect solution... kind-a the same as 'requested' in the very first sentence of this post for all users that like more control over library structuring locally, but made much simpler to implement when thinking of the sandbox is the project.

    Modules would then - depending the configuration - searched first locally in the modules folder, then - again locally - in the shared modules folder - and then in the - espruino.com/modules folder. This configuration can become a bit tricky when the existing of a non-minified should be found first even though a minified version exists in a different precedence / sequence. It is though something to think about.

    (Naming should then be a bit different in the end with sandbox being project folder, project folder being main (level 0, or a like, and would most of the time include only one file, since after all, only one main can run on the mc and mains are not switched or chained, even though they can when stored on sd card using some RYO code), modules keep their name, and an additional - shared modules is chosen - ...)... and again, tripping over my own (thought) feet...

  • Mon 2018.10.08

    'Where was the tilde you mentioned?'

    From #16

    'It is the 'tilde' that precedes the relative folder path that needs attention when selecting the folder for the sandbox.'

    The key "when selecting the folder for the sandbox"



    Settings >> Project >> Select Directory for Sandbox

    I drilled down until

    C:\Users\Robin\Documents\2017\Espruino_s­bx

    and the IDE modal window then displays the relative path in the edit field

    ~\Documents\2017\Espruino_sbx

    This is what Windows/WebIDE assigns, not user input.

    I'm now using

    C:\Espruino

    and the sandbox functionality worked. But now have the nuisance of adding yet another folder to my list of backups, exactly opposite of what the 'Documents' folder concept was supposed to prevent. :-)


    'you're using the filesystem library for something in your code'

    That may be what the output is revealing, but it isn't what I was doing. If #15 is re-read, all I did was add the code file to the projects folder and the module to the modules folder. When I clicked on the 'Projects' button and selected the code file, upload, that error verbatim is revealed. That is why I indicated it was puzzling as it is nothing I intended or attempted. This laptop doesn't even have an SD card option.

    and, a fresh install IDE 0.70.4



    Wow Google is impressive. Found those source files in one search attempt, when I could only remember that I actually did create them, but when?

    What @allObjects created to test the module concept:

    #6 #9 at http://forum.espruino.com/conversations/­325318/ #6 and #9

    Those two short files used verbatim and caused the output as in #15 and ref #17 I used those as allObjects had created and tested.

  • ...any ...x - linux and unix have a fight with any win / ms... or vice versa. More the latter, because the
    x-thinking was before the win / ms thinking:

    • ~ is your home folder in linux / unix
    • - Documents is your home folder for documents in win

    Unfortunately, win has multiple homes, so it does not really know where home is... it is different for different file types (or content types)... a simplification and one less path switch for win users, but a total loss - not win - for everything else in win.

    (last but not least, this is historically, because win came out of a single user, stand alone system... where as linux / unix was built multi-user from the beginning... and not only that, multi-user, multi access level (user, group, world). Win has somehow caught up with that during its life time.

    Bringing both in sync and hide the differences where they do not - and more so - should really matter - aka Espruino - is not a simple task... Especially in the browser, that should not expose anything about the underlaying world.

  • Tue 2019.01.22

    Hi gang, hate to reopen old wounds, but this issue has re-surfaced.

    recap: Put coding on the back burner in November. Started back up a week ago. With nothing more than the passage of time, again, I'm now not able to load modules.


    dup lines removed for brevity and 404 url is truncated

    Splitting for reset(), delay 250
    Splitting for Modules.addCached, delay 250
    >>> Sent
    loadModule(Colors)
    ERROR: Found module, but search took too long.
    Espruino.Core.Utils.getURL: got HTTP status code 404 for http://www.esp.../Colors.min.js
    WARNING: [notify_warn] Module Colors not found
    
      . . .
    
    Found a prompt... great!
    >>> Sending...
    
    



    What changed on my PC on this end?

    • Towards the end of development, had re-flashed to upgrade Pico from 1v93? to 2v00.103
    • Windows has done two required (forced without my consent) updates
    • Chrome went through an update
    • Avast performed both an app and signature update

    What changed on the WebIDE and server side?

    I notice (what appears new) that the phrase 'Splitting for Modules.addCached, delay 250' was added



    EDIT:
    Per #8 above, I disabled Avast shield control for the default ten minutes, and was able to proceed, so far two attempts. This extra step in annoying, especially when making many changes and needing the extra step to canvas the web for supporting reference docs.

    Will update here only if the problem persists.


    EDIT after one hour of changes/send:
    Issue returned. Verified Avast shield control was still disabled. Modules still not found, orange banners continue to appear. The only way to resolve is to: dis-connect, close the IDE, remove power from Pico, apply power, launch IDE, connect, re-open project, select, send. A real pain!

    VERSION: "2v00.103",
    GIT_COMMIT: "df8a910",
    BOARD: "PICO_R1_3",

    Web IDE version 0.70.4

  • What changed on the WebIDE and server side?

    Nothing at all to do with projects has changed. This is 100% something that has changed on your PC. As far as I'm aware you are basically the only user that's hitting this out of thousands of Web IDE users.

    While someone could possibly rewrite the way 'projects' handles loading files the whole situation is a bit of a mess with Projects only working on Chrome apps (and windows native), which is deprecated and disappearing soon anyway. At some point I'd like to add an online element to the IDE that'd just pull files from a user account espruino.com and avoid all this, but that is some way off.

    Honestly all I can suggest is to put your modules online or on a local webserver and instead require them via URL.

    Or is defragmentation still a thing on your PC? If so, I'd do that - it might be that just having a less fragmented hard disk would speed up the access time and would fix your problems.

    Failing that - time to upgrade to an SSD?

  • Wed 2019.01.23

    '. . . this out of thousands of Web IDE users'

    It would be interesting to know how many of those individuals are developing modules that have at least 30K byte source file size. Or for that matter how many even develop modules. My guess is only a handful.

    '. . . put your modules online'

    Nice if they didn't need development. Trying to develop smaller functions using the IDE editor, then move them to the module. That would reduce the need to upload to a remote server, each time to test.

    'time to upgrade to an SSD?'

    Out of the two users I know have a 1T SSD, one failed losing everything, just after six months of use. At a 50% failure rate (of those I know), I'll hold off for a bit. But a PC is in the budget for later this year.

  • Maybe try a webserver on your local PC? It can then directly serve up the files you're developing in whatever IDE you want - so no upload/copy needed.

    SSDs may very occasionally fail and lose everything, but so do hard disks - I believe far more often than SSDs. Even with RAID computers get stolen, dropped, accidentally formatted, etc too - you need backups regardless of the storage you're using.

  • 'Maybe try a webserver on your local PC?'

    I have xampp already installed, so I'll try that. It's a constant battle trying to decide which balance of time use will work in the long run, e.g. remote GitHub vs local server vs close and re-open IDE. Living with the sequence in Edit 2 of #21 for now, as opposed to file copying test modules to the xampp file structure or u/l to GitHub.


    ' but so do hard disks' (fail)

    From twenty to ten years ago, I've personally had two Western Digital and one Seagate go the dreadful 'Click' death, along with a Dell laptop five years ago. For full size HD's, get near or above (twenty yr ago rating method) the 10,000 hr MTBF mileage, but for laptops, only 5000 hrs of use. The reason for a laptop purchase (which most likely will be SSD) (I'm at 3000 now) on the horizon. ;-)

    Note that 8hr/dy is 2920hr/yr and 10,000hr is 3.4yrs



    Interesting read:

    https://www.wepc.com/tips/ssd-reliabilit­y/

    Mfg MTBF is now a cumulative (as I was curious why figures are now ten+ times higher) reported figure, and SSD's close to HD this day and age.

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

Placing module code in local modules folder doesn't appear to be located by Native IDE

Posted by Avatar for Robin @Robin

Actions