• 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

  • 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