espruino / EspruinoTools

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

EspruinoTools to exe #176

Open msaigla opened 5 months ago

msaigla commented 5 months ago

Hi I want to use EspruinoTools without nodejs. I'm trying to turn EspruinoTools into an exe using pkg. But I get an error on time using the command .\dist\espruino-win.exe -p COM6:

Espruino Command-line Tool 0.1.54
-----------------------------------

Connecting to 'COM6'
(node:25752) [DEP0128] DeprecationWarning: Invalid 'main' field in 'C:\snapshot\EspruinoTools-master\node_modules\node-blob\package.json' of 'server.js'. Please either fix that or report it to the module author
(Use `espruino-win --trace-deprecation ...` to show where the warning was created)
undefined:56
    } else throw err;
           ^

Error: spawn C:\snapshot\EspruinoTools-master\node_modules\noble-winrt\prebuilt\BLEServer.exe ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
    at onErrorNT (node:internal/child_process:478:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
    at process.runNextTicks [as _tickCallback] (node:internal/process/task_queues:65:3)
    at Function.runMain (pkg/prelude/bootstrap.js:1980:13)
    at node:internal/main/run_main_module:17:47
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (node:internal/child_process:289:12)
    at onErrorNT (node:internal/child_process:478:16)
    [... lines matching original stack trace ...]
    at node:internal/main/run_main_module:17:47 {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn C:\\snapshot\\EspruinoTools-master\\node_modules\\noble-winrt\\prebuilt\\BLEServer.exe',
  path: 'C:\\snapshot\\EspruinoTools-master\\node_modules\\noble-winrt\\prebuilt\\BLEServer.exe',
  spawnargs: [ '' ]
}

PKG settings:

"pkg": {
    "scripts": [
      "libs/**/*.js",
      "espruino.js",
      "core/**/*.js",
      "plugins/**/*.js"
    ],
    "outputPath": "dist"
  },
msaigla commented 5 months ago

I have solved the problem. It helped: npm remove noble --verbose npm remove noble-winrt --verbose

but now it does not connect to the ports

gfwilliams commented 5 months ago

Ok, thanks ofr the update. Yes, noble handles the Bluetooth comms - you may have some success trying to make it use noble-uwp instead?

msaigla commented 5 months ago

It don't work

.\dist\espruino-win.exe --list --verbose
0.1.55
Espruino Command-line Tool 0.1.55
-----------------------------------

Acorn library not found - you'll need it for compiled code
Found C:\snapshot\evolvector_studio\other_files\espruino/libs/targz.js
Found C:\snapshot\evolvector_studio\other_files\espruino/libs/utf8.js
Found C:\snapshot\evolvector_studio\other_files\espruino/libs/webrtc-connection.js
Found C:\snapshot\evolvector_studio\other_files\espruino/libs/esprima/escodegen.js
Found C:\snapshot\evolvector_studio\other_files\espruino/libs/esprima/esmangle.js
Found C:\snapshot\evolvector_studio\other_files\espruino/libs/esprima/esprima.js
Found C:\snapshot\evolvector_studio\other_files\espruino/espruino.js
Found C:\snapshot\evolvector_studio\other_files\espruino/core/codeWriter.js
Found C:\snapshot\evolvector_studio\other_files\espruino/core/config.js
Found C:\snapshot\evolvector_studio\other_files\espruino/core/env.js
Found C:\snapshot\evolvector_studio\other_files\espruino/core/flasher.js
Found C:\snapshot\evolvector_studio\other_files\espruino/core/flasherESP8266.js
Found C:\snapshot\evolvector_studio\other_files\espruino/core/modules.js
Found C:\snapshot\evolvector_studio\other_files\espruino/core/notifications.js
Found C:\snapshot\evolvector_studio\other_files\espruino/core/serial.js
Found C:\snapshot\evolvector_studio\other_files\espruino/core/serial_chrome_serial.js
No chrome.serial - Chrome Serial disabled
Found C:\snapshot\evolvector_studio\other_files\espruino/core/serial_chrome_socket.js
No chrome.sockets - Chrome Socket disabled
Found C:\snapshot\evolvector_studio\other_files\espruino/core/serial_frame.js
serial_frame: Not running in a browser
Found C:\snapshot\evolvector_studio\other_files\espruino/core/serial_noble.js
Found C:\snapshot\evolvector_studio\other_files\espruino/core/serial_node_serial.js
Error initialising 'serialport':Error: No native build was found for platform=win32 arch=x64 runtime=node abi=93 uv=1 libc=glibc node=16.16.0
    loaded from: C:\snapshot\evolvector_studio\other_files\espruino\node_modules\@serialport\bindings-cpp

Found C:\snapshot\evolvector_studio\other_files\espruino/core/serial_node_socket.js
Found C:\snapshot\evolvector_studio\other_files\espruino/core/serial_webrtc.js
Remote Connection enabled
Found C:\snapshot\evolvector_studio\other_files\espruino/core/serial_websocket_local.js
Found C:\snapshot\evolvector_studio\other_files\espruino/core/serial_websocket_relay.js
WebSocket relay support enabled
Found C:\snapshot\evolvector_studio\other_files\espruino/core/serial_web_audio.js
Found C:\snapshot\evolvector_studio\other_files\espruino/core/serial_web_bluetooth.js
Found C:\snapshot\evolvector_studio\other_files\espruino/core/serial_web_serial.js
Found C:\snapshot\evolvector_studio\other_files\espruino/core/terminal.js
Found C:\snapshot\evolvector_studio\other_files\espruino/core/utils.js
Found C:\snapshot\evolvector_studio\other_files\espruino/plugins/assembler.js
Found C:\snapshot\evolvector_studio\other_files\espruino/plugins/boardJSON.js
Found C:\snapshot\evolvector_studio\other_files\espruino/plugins/compiler.js
Found C:\snapshot\evolvector_studio\other_files\espruino/plugins/getGitHub.js
Found C:\snapshot\evolvector_studio\other_files\espruino/plugins/localModules.js
Found C:\snapshot\evolvector_studio\other_files\espruino/plugins/minify.js
Found C:\snapshot\evolvector_studio\other_files\espruino/plugins/pretokenise.js
Found C:\snapshot\evolvector_studio\other_files\espruino/plugins/saveOnSend.js
Found C:\snapshot\evolvector_studio\other_files\espruino/plugins/setTime.js
Found C:\snapshot\evolvector_studio\other_files\espruino/plugins/unicode.js
UTF8 Library loaded successfully
Found C:\snapshot\evolvector_studio\other_files\espruino/plugins/versionChecker.js
Initialising CodeWriter
Initialising Config
Initialising Env
Initialising Flasher
Initialising FlasherESP8266
Initialising Modules
Initialising Notifications
Initialising Serial
  - Initialising Serial Noble Bluetooth LE
  - Initialising Serial Node Socket
  - Initialising Serial Remote Connection
  - Initialising Serial Websocket Relay
  - Initialising Serial Web Audio
  - Initialising Serial Web Bluetooth
  - Initialising Serial Web Serial
Initialising RemoteConnection
Initialising SerialWebSocketRelay
Initialising Utils
Initialising Status
Initialising Assembler
Initialising BoardJSON
Initialising Compiler
Initialising GetGitHub
Initialising LocalModules
Initialising Minify
Initialising Unicode
Initialising VersionChecker
Initialising CoreModules
Initialising Pretokenise
Initialising SaveOnSend
Initialising SetTime
Searching for serial ports...
Noble: getPorts - initialising...
Noble: module couldn't be loaded, no node.js Bluetooth Low Energy
 Error: No native build was found for platform=win32 arch=x64 runtime=node abi=93 uv=1 libc=glibc node=16.16.0
    loaded from: C:\snapshot\evolvector_studio\other_files\espruino\node_modules\bluetooth-hci-socket\node_modules\usb

    at Function.<anonymous> (C:\snapshot\evolvector_studio\other_files\espruino\node_modules\node-gyp-build\node-gyp-build.js:60:9)
    at load (C:\snapshot\evolvector_studio\other_files\espruino\node_modules\node-gyp-build\node-gyp-build.js:22:30)
    at Object.<anonymous> (C:\snapshot\evolvector_studio\other_files\espruino\node_modules\bluetooth-hci-socket\node_modules\usb\usb.js:1:125)
    at Module._compile (pkg/prelude/bootstrap.js:1926:22)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at Module.require (pkg/prelude/bootstrap.js:1851:31)
    at require (node:internal/modules/cjs/helpers:102:18)
Error: No Ports Found

It do work

PS C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino> node bin\espruino-cli.js --list --verbose
0.1.55
Espruino Command-line Tool 0.1.55
-----------------------------------

Acorn library not found - you'll need it for compiled code
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/libs/targz.js
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/libs/utf8.js
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/libs/webrtc-connection.js
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/libs/esprima/escodegen.js
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/libs/esprima/esmangle.js
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/libs/esprima/esprima.js
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/espruino.js
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/core/codeWriter.js
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/core/config.js
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/core/env.js
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/core/flasher.js
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/core/flasherESP8266.js
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/core/modules.js
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/core/notifications.js
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/core/serial.js
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/core/serial_chrome_serial.js
No chrome.serial - Chrome Serial disabled
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/core/serial_chrome_socket.js
No chrome.sockets - Chrome Socket disabled
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/core/serial_frame.js
serial_frame: Not running in a browser
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/core/serial_noble.js
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/core/serial_node_serial.js
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/core/serial_node_socket.js
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/core/serial_webrtc.js
Remote Connection enabled
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/core/serial_websocket_local.js
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/core/serial_websocket_relay.js
WebSocket relay support enabled
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/core/serial_web_audio.js
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/core/serial_web_bluetooth.js
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/core/serial_web_serial.js
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/core/terminal.js
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/core/utils.js
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/plugins/assembler.js
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/plugins/boardJSON.js
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/plugins/compiler.js
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/plugins/getGitHub.js
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/plugins/localModules.js
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/plugins/minify.js
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/plugins/pretokenise.js
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/plugins/saveOnSend.js
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/plugins/setTime.js
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/plugins/unicode.js
UTF8 Library loaded successfully
Found C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino/plugins/versionChecker.js
Initialising CodeWriter
Initialising Config
Initialising Env
Initialising Flasher
Initialising FlasherESP8266
Initialising Modules
Initialising Notifications
Initialising Serial
  - Initialising Serial Noble Bluetooth LE
  - Initialising Serial Node Serial
  - Initialising Serial Node Socket
  - Initialising Serial Remote Connection
  - Initialising Serial Websocket Relay
  - Initialising Serial Web Audio
  - Initialising Serial Web Bluetooth
  - Initialising Serial Web Serial
Initialising RemoteConnection
Initialising SerialWebSocketRelay
Initialising Utils
Initialising Status
Initialising Assembler
Initialising BoardJSON
Initialising Compiler
Initialising GetGitHub
Initialising LocalModules
Initialising Minify
Initialising Unicode
Initialising VersionChecker
Initialising CoreModules
Initialising Pretokenise
Initialising SaveOnSend
Initialising SetTime
Searching for serial ports...
Noble: getPorts - initialising...
(node:9336) [DEP0128] DeprecationWarning: Invalid 'main' field in 'C:\Users\msaig\Desktop\progres\evolvector\studio\evolvector_studio\other_files\espruino\node_modules\node-blob\package.json' of 'server.js'. Please either fix that or report it to the module author
(Use `node --trace-deprecation ...` to show where the warning was created)
PORTS:
  COM6  (STMicroelectronics.)
Noble: stateChange -> poweredOff
Noble: getPorts - initialising...
Noble: getPorts - initialising...
Noble: getPorts - initialising...
Noble: getPorts - initialising...
Noble: getPorts - initialising...
Noble: getPorts - initialising...