espruino / EspruinoTools

JavaScript library of tools for Espruino - used for the Web IDE, CLI, etc.
Apache License 2.0
150 stars 90 forks source link

Error EspruinoTools and JQuery 3.6.0. #147

Closed msaigla closed 2 years ago

msaigla commented 2 years ago

Hello! I used: Electron js When I connect EspruinoTools. There are problems: `Acorn library not found - you'll need it for compiled code C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino/libs/targz.js C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino/libs/utf8.js C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino/espruino.js C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino/core/codeWriter.js C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino/core/config.js C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino/core/env.js C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino/core/flasher.js C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino/core/modules.js C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino/core/notifications.js C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino/core/serial.js C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino/core/serial_audio.js VM787:26 [Deprecation] The ScriptProcessorNode is deprecated. Use AudioWorkletNode instead. (https://bit.ly/audio-worklet) eval @ VM787:26 eval @ VM787:221 loadJS @ C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:10 loadDir @ C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:20 init @ C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:93 (anonymous) @ compileJS.js:11 VM787:28 serial_audio: Audio Sample rate : 48000 VM787:31 serial_audio: Audio Serial Baud 9600 Bit time 5 C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino/core/serial_bleat.js VM788:15 Error: Cannot find module 'bleat' Require stack:

C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js C:\Users\msaig\OneDrive\progres\exp\example\jsPage.html at Module._resolveFilename (node:internal/modules/cjs/loader:940:15) at Function.o._resolveFilename (node:electron/js2c/renderer_init:33:1095) at Module._load (node:internal/modules/cjs/loader:785:27) at Function.c._load (node:electron/js2c/asar_bundle:5:13331) at Function.o._load (node:electron/js2c/renderer_init:33:356) at Module.require (node:internal/modules/cjs/loader:1012:19) at require (node:internal/modules/cjs/helpers:102:18) at eval (eval at loadJS (C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:10:10), :12:13) at eval (eval at loadJS (C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:10:10), :194:3) at loadJS (C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:10:10) eval @ VM788:15 eval @ VM788:194 loadJS @ C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:10 loadDir @ C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:20 init @ C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:93 (anonymous) @ compileJS.js:11 VM788:16 bleat module not loaded - no node.js Bluetooth Low Energy C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino/core/serial_chrome.js C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino/core/serial_chrome_pre_m33.js C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino/core/serial_nodeserial.js C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino/core/serial_socket.js VM828:21 No chrome.sockets - serial_socket disabled C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino/core/serial_web_bluetooth.js C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino/core/settingsAbout.js C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino/core/status.js C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino/core/terminal.js C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino/core/utils.js C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino/plugins/assembler.js C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino/plugins/boardJSON.js C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino/plugins/compiler.js C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino/plugins/getGitHub.js C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino/plugins/localModules.js C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino/plugins/minify.js C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino/plugins/npmModules.js C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino/plugins/setTime.js C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino/plugins/uiMode.js C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino/plugins/unicode.js C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino/plugins/versionChecker.js C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino/plugins/_examplePlugin.js VM779:45 Initialising CodeWriter VM779:45 Initialising Config VM779:45 Initialising Env VM779:45 Initialising Flasher VM779:45 Initialising Modules VM779:45 Initialising Notifications VM779:45 Initialising Serial VM779:45 Initialising SettingsAbout VM779:45 Initialising Status VM779:45 Initialising Terminal VM832:59 Uncaught TypeError: $.get is not a function at Object.init (eval at loadJS (C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:10:10), :59:7) at initModule (eval at loadJS (C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:10:10), :47:15) at eval (eval at loadJS (C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:10:10), :51:37) at eval (eval at loadJS (C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:10:10), :82:9) at _get (eval at loadJS (C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:10:10), :57:7) at Object.loadConfiguration (eval at loadJS (C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:10:10), :73:5) at init (eval at loadJS (C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:10:10), :42:26) at C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:106:32 at Array.forEach () at Object.init (C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:106:11) init @ VM832:59 initModule @ VM779:47 eval @ VM779:51 eval @ VM781:82 get @ VM781:57 loadConfiguration @ VM781:73 init @ VM779:42 (anonymous) @ C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:106 init @ C:\Users\msaig\OneDrive\progres\exp\example\node_modules\espruino\index.js:106 (anonymous) @ compileJS.js:11 main.js?ver=1.0:3 Uncaught TypeError: $(...).click is not a function at main.js?ver=1.0:3:25 (anonymous) @ main.js?ver=1.0:3 separator.js:1 Uncaught TypeError: $(...).on is not a function at separator.js:1:27 (anonymous) @ separator.js:1 javascript.js:105 Uncaught TypeError: $(...).empty is not a function at updateFunction (javascript.js:105:20) at Blockly.WorkspaceSvg.Blockly.Workspace.fireChangeListener (blockly_compressed.js:3405:57) at Blockly.Events.fireNow (field_multilineinput.js:368:9) My Code: const esp = require("espruino");

let port = "COM6"; let noUpload = true;

function messageConsole(msg) { $("#message-console").append("

" + msg + " "); $('#console-window').scrollTop($('#console-window').prop('scrollHeight')); } esp.init(function() { esp.sendCode("COM7", "LED1.write(true);\n", function() { console.log('Done!'); }); });`

gfwilliams commented 2 years ago

Hi - where did you get EspruinoTools from to do this?

Because the error seems to come from serial_bleat.js but no such file exists in https://github.com/espruino/EspruinoTools/tree/master/core

msaigla commented 2 years ago

I used the command: npm install espruino

gfwilliams commented 2 years ago

Please can you try and update the package now? I just pushed a new version and it definitely doesn't have the file in, so if that fails with the same error, something is very broken:

npm notice === Tarball Contents === 
npm notice 10.3kB  LICENSE                       
npm notice 17.7kB  README.md                     
npm notice 32.2kB  bin/espruino-cli.js           
npm notice 9.4kB   core/codeWriter.js            
npm notice 6.4kB   core/config.js                
npm notice 4.4kB   core/env.js                   
npm notice 14.9kB  core/flasher.js               
npm notice 8.9kB   core/flasherESP8266.js        
npm notice 9.0kB   core/modules.js               
npm notice 979B    core/notifications.js         
npm notice 3.5kB   core/serial_chrome_serial.js  
npm notice 4.0kB   core/serial_chrome_socket.js  
npm notice 4.0kB   core/serial_frame.js          
npm notice 8.6kB   core/serial_noble.js          
npm notice 6.3kB   core/serial_node_ble.js       
npm notice 3.7kB   core/serial_node_serial.js    
npm notice 2.8kB   core/serial_node_socket.js    
npm notice 1.2kB   core/serial_test.js.test      
npm notice 8.0kB   core/serial_web_audio.js      
npm notice 9.7kB   core/serial_web_bluetooth.js  
npm notice 5.9kB   core/serial_web_serial.js     
npm notice 5.0kB   core/serial_websocket_local.js
npm notice 3.5kB   core/serial_websocket_relay.js
npm notice 3.2kB   core/serial_winnus.js         
npm notice 16.5kB  core/serial.js                
npm notice 27.7kB  core/terminal.js              
npm notice 29.6kB  core/utils.js                 
npm notice 4.8kB   espruino.js                   
npm notice 6.7kB   index.js                      
npm notice 207.1kB libs/esprima/escodegen.js     
npm notice 599.8kB libs/esprima/esmangle.js      
npm notice 283.6kB libs/esprima/esprima.js       
npm notice 123B    libs/README.md                
npm notice 34.7kB  libs/targz.js                 
npm notice 6.4kB   libs/utf8.js                  
npm notice 1.2kB   package.json                  
npm notice 770B    plugins/_examplePlugin.js     
npm notice 23.6kB  plugins/assembler.js          
npm notice 1.7kB   plugins/boardJSON.js          
npm notice 5.8kB   plugins/compiler.js           
npm notice 1.2kB   plugins/getGitHub.js          
npm notice 4.2kB   plugins/localModules.js       
npm notice 8.7kB   plugins/minify.js             
npm notice 7.5kB   plugins/pretokenise.js        
npm notice 4.5kB   plugins/saveOnSend.js         
npm notice 1.3kB   plugins/setTime.js            
npm notice 2.8kB   plugins/unicode.js            
npm notice 3.1kB   plugins/versionChecker.js  
msaigla commented 2 years ago
Acorn library not found - you'll need it for compiled code
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/libs/targz.js
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/libs/utf8.js
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/libs/esprima/escodegen.js
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/libs/esprima/esmangle.js
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/libs/esprima/esprima.js
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/espruino.js
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/core/codeWriter.js
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/core/config.js
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/core/env.js
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/core/flasher.js
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/core/flasherESP8266.js
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/core/modules.js
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/core/notifications.js
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/core/serial.js
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/core/serial_chrome_serial.js
VM439:23 No chrome.serial - Chrome Serial disabled
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/core/serial_chrome_socket.js
VM440:21 No chrome.sockets - Chrome Socket disabled
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/core/serial_frame.js
VM441:17 serial_frame: Not running inside an iframe
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/core/serial_noble.js
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/core/serial_node_ble.js
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/core/serial_node_serial.js
VM545:15 No 'serialport' module found
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/core/serial_node_socket.js
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/core/serial_websocket_local.js
VM557:7 WebSocket localhost support (EspruinoHost) enabled - running in web browser
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/core/serial_websocket_relay.js
VM558:16 WebSocket relay support enabled - running in web browser
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/core/serial_web_audio.js
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/core/serial_web_bluetooth.js
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/core/serial_web_serial.js
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/core/serial_winnus.js
VM562:12 'winnus' module not found, no Windows Bluetooth Low Energy Error: Cannot find module 'winnus'
Require stack:
- C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js
- C:\Users\msaig\OneDrive\progres\exp\exp_studio\main.html
    at Module._resolveFilename (node:internal/modules/cjs/loader:940:15)
    at Function.o._resolveFilename (node:electron/js2c/renderer_init:33:1095)
    at Module._load (node:internal/modules/cjs/loader:785:27)
    at Function.c._load (node:electron/js2c/asar_bundle:5:13331)
    at Function.o._load (node:electron/js2c/renderer_init:33:356)
    at Module.require (node:internal/modules/cjs/loader:1012:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at eval (eval at loadJS (C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:12:11), <anonymous>:10:14)
    at eval (eval at loadJS (C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:12:11), <anonymous>:124:3)
    at loadJS (C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:12:11)
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/core/terminal.js
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/core/utils.js
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/plugins/assembler.js
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/plugins/boardJSON.js
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/plugins/compiler.js
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/plugins/getGitHub.js
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/plugins/localModules.js
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/plugins/minify.js
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/plugins/pretokenise.js
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/plugins/saveOnSend.js
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/plugins/setTime.js
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/plugins/unicode.js
VM574:27 UTF8 Library loaded successfully
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/plugins/versionChecker.js
VM432:47 GET window.localStorage = null
VM430:48 Initialising CodeWriter
VM430:48 Initialising Config
VM430:48 Initialising Env
VM430:48 Initialising Flasher
VM430:48 Initialising FlasherESP8266
VM430:48 Initialising Modules
VM430:48 Initialising Notifications
VM430:48 Initialising Serial
VM438:81   - Initialising Serial Noble Bluetooth LE
VM438:81   - Initialising Serial Node-ble Bluetooth LE
VM438:81   - Initialising Serial Node Socket
VM438:81   - Initialising Serial Websocket to EspruinoHost
VM438:81   - Initialising Serial Websocket Relay
VM438:81   - Initialising Serial Web Audio
VM438:81   - Initialising Serial Web Bluetooth
VM438:81   - Initialising Serial Web Serial
VM561:51 Serial> serial.getPorts exists - grab known devices
VM430:48 Initialising SerialWebSocketLocal
VM430:48 Initialising Terminal
VM430:53 Module initialisation failed for Terminal TypeError: Cannot set properties of null (setting 'innerHTML')
    at Object.init (eval at loadJS (C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:12:11), <anonymous>:101:24)
    at initModule (eval at loadJS (C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:12:11), <anonymous>:51:17)
    at eval (eval at loadJS (C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:12:11), <anonymous>:66:11)
    at Array.forEach (<anonymous>)
    at initModules (eval at loadJS (C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:12:11), <anonymous>:65:21)
    at eval (eval at loadJS (C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:12:11), <anonymous>:70:7)
    at eval (eval at loadJS (C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:12:11), <anonymous>:95:9)
    at _get (eval at loadJS (C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:12:11), <anonymous>:53:7)
    at Object.loadConfiguration (eval at loadJS (C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:12:11), <anonymous>:86:5)
    at Object.init (eval at loadJS (C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:12:11), <anonymous>:45:26)
initModule @ VM430:53
eval @ VM430:66
initModules @ VM430:65
eval @ VM430:70
eval @ VM432:95
_get @ VM432:53
loadConfiguration @ VM432:86
init @ VM430:45
init @ C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:99
(anonymous) @ compileJS.js:11
VM430:48 Initialising Utils
VM430:48 Initialising Status
VM430:48 Initialising Assembler
VM430:48 Initialising BoardJSON
VM430:48 Initialising Compiler
VM430:48 Initialising GetGitHub
VM430:48 Initialising LocalModules
VM430:48 Initialising Minify
VM430:48 Initialising Unicode
VM430:48 Initialising VersionChecker
VM430:48 Initialising CoreModules
VM430:48 Initialising Pretokenise
VM430:48 Initialising SaveOnSend
VM430:48 Initialising SetTime
C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:56 Already initialised.
VM442:143 Noble: getPorts - initialising...
VM442:67 Noble: module couldn't be loaded, no node.js Bluetooth Low Energy
 Error: Cannot find module '@abandonware/noble'
Require stack:
- C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js
- C:\Users\msaig\OneDrive\progres\exp\exp_studio\main.html
    at Module._resolveFilename (node:internal/modules/cjs/loader:940:15)
    at Function.o._resolveFilename (node:electron/js2c/renderer_init:33:1095)
    at Module._load (node:internal/modules/cjs/loader:785:27)
    at Function.c._load (node:electron/js2c/asar_bundle:5:13331)
    at Function.o._load (node:electron/js2c/renderer_init:33:356)
    at Module.require (node:internal/modules/cjs/loader:1012:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at startNoble (eval at loadJS (C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:12:11), <anonymous>:64:17)
    at Object.getPorts (eval at loadJS (C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:12:11), <anonymous>:145:14)
    at eval (eval at loadJS (C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:12:11), <anonymous>:109:14)
VM443:101 Getting ports
VM432:47 GET window.localStorage = null
VM430:48 Initialising CodeWriter
VM430:48 Initialising Config
VM430:48 Initialising Env
VM430:48 Initialising Flasher
VM430:48 Initialising FlasherESP8266
VM430:48 Initialising Modules
VM430:48 Initialising Notifications
VM430:48 Initialising Serial
VM438:81   - Initialising Serial Noble Bluetooth LE
VM438:81   - Initialising Serial Node-ble Bluetooth LE
VM438:81   - Initialising Serial Node Socket
VM438:81   - Initialising Serial Websocket to EspruinoHost
VM438:81   - Initialising Serial Websocket Relay
VM438:81   - Initialising Serial Web Audio
VM438:81   - Initialising Serial Web Bluetooth
VM438:81   - Initialising Serial Web Serial
VM561:51 Serial> serial.getPorts exists - grab known devices
VM430:48 Initialising SerialWebSocketLocal
VM430:48 Initialising Terminal
VM430:53 Module initialisation failed for Terminal TypeError: Cannot set properties of null (setting 'innerHTML')
    at Object.init (eval at loadJS (C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:12:11), <anonymous>:101:24)
    at initModule (eval at loadJS (C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:12:11), <anonymous>:51:17)
    at eval (eval at loadJS (C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:12:11), <anonymous>:66:11)
    at Array.forEach (<anonymous>)
    at initModules (eval at loadJS (C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:12:11), <anonymous>:65:21)
    at eval (eval at loadJS (C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:12:11), <anonymous>:70:7)
    at eval (eval at loadJS (C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:12:11), <anonymous>:95:9)
    at _get (eval at loadJS (C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:12:11), <anonymous>:53:7)
    at Object.loadConfiguration (eval at loadJS (C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:12:11), <anonymous>:86:5)
    at HTMLDocument.init (eval at loadJS (C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:12:11), <anonymous>:45:26)
initModule @ VM430:53
eval @ VM430:66
initModules @ VM430:65
eval @ VM430:70
eval @ VM432:95
_get @ VM432:53
loadConfiguration @ VM432:86
init @ VM430:45
VM430:48 Initialising Utils
VM430:48 Initialising Status
VM430:48 Initialising Assembler
VM430:48 Initialising BoardJSON
VM430:48 Initialising Compiler
VM430:48 Initialising GetGitHub
VM430:48 Initialising LocalModules
VM430:48 Initialising Minify
VM430:48 Initialising Unicode
VM430:48 Initialising VersionChecker
VM430:48 Initialising CoreModules
VM430:48 Initialising Pretokenise
VM430:48 Initialising SaveOnSend
VM430:48 Initialising SetTime
VM564:666          GET file:///C:/Users/msaig/OneDrive/progres/exp/exp_studio/manifest.json net::ERR_FILE_NOT_FOUND
getVersion @ VM564:666
getVersionInfo @ VM564:670
init @ VM563:92
initModule @ VM430:51
eval @ VM430:66
initModules @ VM430:65
eval @ VM430:70
eval @ VM432:95
_get @ VM432:53
loadConfiguration @ VM432:86
init @ VM430:45
init @ C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:99
(anonymous) @ compileJS.js:11
VM564:666          GET file:///C:/Users/msaig/OneDrive/progres/exp/exp_studio/manifest.json net::ERR_FILE_NOT_FOUND
getVersion @ VM564:666
getVersionInfo @ VM564:670
init @ VM563:92
initModule @ VM430:51
eval @ VM430:66
initModules @ VM430:65
eval @ VM430:70
eval @ VM432:95
_get @ VM432:53
loadConfiguration @ VM432:86
init @ VM430:45
node:electron/js2c/renderer_init:89 Electron Security Warning (Insecure Content-Security-Policy) This renderer process has either no Content Security
  Policy set or a policy with "unsafe-eval" enabled. This exposes users of
  this app to unnecessary security risks.

For more information and help, consult
https://electronjs.org/docs/tutorial/security.
This warning will not show up
once the app is packaged.
warnAboutInsecureCSP @ node:electron/js2c/renderer_init:89
logSecurityWarnings @ node:electron/js2c/renderer_init:89
(anonymous) @ node:electron/js2c/renderer_init:89
load (async)
securityWarnings @ node:electron/js2c/renderer_init:89
(anonymous) @ node:electron/js2c/renderer_init:69
./lib/renderer/common-init.ts @ node:electron/js2c/renderer_init:69
__webpack_require__ @ node:electron/js2c/renderer_init:1
(anonymous) @ node:electron/js2c/renderer_init:73
./lib/renderer/init.ts @ node:electron/js2c/renderer_init:73
__webpack_require__ @ node:electron/js2c/renderer_init:1
(anonymous) @ node:electron/js2c/renderer_init:1
___electron_webpack_init__ @ node:electron/js2c/renderer_init:1
(anonymous) @ node:electron/js2c/renderer_init:141
compileForInternalLoader @ node:internal/bootstrap/loaders:312
compileForPublicLoader @ node:internal/bootstrap/loaders:252
loadNativeModule @ node:internal/modules/cjs/helpers:49
Module._load @ node:internal/modules/cjs/loader:811
c._load @ node:electron/js2c/asar_bundle:5
executeUserEntryPoint @ node:internal/modules/run_main:81
(anonymous) @ node:internal/main/run_main_module:17
node:events:368 Uncaught Error: connect ENOENT /var/run/dbus/system_bus_socket
    at __node_internal_captureLargerStackTrace (node:internal/errors:464:5)
    at __node_internal_exceptionWithHostPort (node:internal/errors:642:12)
    at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1161:16)
__node_internal_captureLargerStackTrace @ node:internal/errors:464
__node_internal_exceptionWithHostPort @ node:internal/errors:642
afterConnect @ node:net:1161
VM442:55 Uncaught Error: connect ENOENT /var/run/dbus/system_bus_socket
    at __node_internal_captureLargerStackTrace (node:internal/errors:464:5)
    at __node_internal_exceptionWithHostPort (node:internal/errors:642:12)
    at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1161:16)
__node_internal_captureLargerStackTrace @ node:internal/errors:464
__node_internal_exceptionWithHostPort @ node:internal/errors:642
afterConnect @ node:net:1161
error (async)
(anonymous) @ node:electron/js2c/renderer_init:73
./lib/renderer/init.ts @ node:electron/js2c/renderer_init:73
__webpack_require__ @ node:electron/js2c/renderer_init:1
(anonymous) @ node:electron/js2c/renderer_init:1
___electron_webpack_init__ @ node:electron/js2c/renderer_init:1
(anonymous) @ node:electron/js2c/renderer_init:141
compileForInternalLoader @ node:internal/bootstrap/loaders:312
compileForPublicLoader @ node:internal/bootstrap/loaders:252
loadNativeModule @ node:internal/modules/cjs/helpers:49
Module._load @ node:internal/modules/cjs/loader:811
c._load @ node:electron/js2c/asar_bundle:5
executeUserEntryPoint @ node:internal/modules/run_main:81
(anonymous) @ node:internal/main/run_main_module:17
VM564:488 Error: ENOENT: no such file or directory, open 'C:\serial\ports'
eval @ VM564:488
readFileAfterOpen @ node:fs:314
VM558:29 /serial/ports doesn't exist - disabling WebSocket support
VM557:29 WebSocket connection to 'wss://localhost:31234/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
ensureConnection @ VM557:29
getPorts @ VM557:103
eval @ VM438:109
getPorts @ VM438:107
openSerialInternal @ VM438:154
openSerial @ VM438:145
(anonymous) @ C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:124
init @ C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:57
sendCode @ C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:118
(anonymous) @ compileJS.js:12
init @ C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:100
(anonymous) @ compileJS.js:11
VM557:106 Couldn't connect to wss://localhost:31234 - disabling websockets for this session
gfwilliams commented 2 years ago

What command are you using to run this?

The espruino/EspruinoTools CLI app is just a CLI that you run with espruino so I'm not sure I understand why electron is being used?

msaigla commented 2 years ago

I'm trying write application in electron js. The application will work with the board JS. Command run electron.js: npm start When it turns on electron.js. An interface appears with the "Turn on the LED" button. By clicking on the button , the following is performed:

esp.init(function() {
    esp.sendCode("COM7", "LED1.write(true);\n", function() {
        console.log('Done!');
    });
});
gfwilliams commented 2 years ago

Ahh, ok - that explains a lot!

Well, am I right in thinking that the error that's actually breaking things for you is VM430:53 Module initialisation failed for Terminal TypeError: Cannot set properties of null (setting 'innerHTML') - or is it something else?

Generally EspruinoTools checks to see if window/etc is defined to figure out if it's running in a Web Browser or not, and I guess in this case, running in Electron is really confusing it - it's thinking there is a terminal window, but there isn't.

I can add a check for that eventuality but I think unless you can come up with a really simple project for me that I can clone and use to test, you'll have to dig into this a bit yourself and see if there are other changes needed.

Another option is I can't remember for sure with Electron, but do you have a separate execution context that isn't related to the window? If so you could just use EspruinoTools from that and it'd work fine

msaigla commented 2 years ago

Git repo: https://github.com/msaigla/electronWithEspruinoTools.git Also your CLI conflicts with JQuery 3.6.0

gfwilliams commented 2 years ago

Thanks, just tried this and actually your issue seems to be:

C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino\index.js:8 Found C:\Users\msaig\OneDrive\progres\exp\exp_studio\node_modules\espruino/core/serial_node_serial.js
VM545:15 No 'serialport' module found

Which on closer inspection is caused by the error:

Error: Loading non-context-aware native module in renderer: '/home/gw/tmp/electronWithEspruinoTools/node_modules/@serialport/bindings/build/Release/bindings.node'. See https://github.com/electron/electron/issues/18397.

when loading serialport. So this isn't really EspruinoTools problem at all. It's just that the serialport module isn't set up right.

I'll add fixes for the other issues now.