Espruino Web IDE on NPM (with Electron)

Posted on
  • Hi,

    There's now a version of the Espruino Web IDE that runs under Node.js:

    https://github.com/espruino/EspruinoWebIDE#installing-from-npm

    It can be installed without Chrome, on Windows, Mac and Linux. At the moment it supports USB, Serial, and Bluetooth Low Energy.

    So if you have a BBC Micro:bit or a Nordic device you've got Espruino running on, this is probably what you want (at least until more devices support Web Bluetooth).

  • This is great to see! Nearly works for me with Pico plugged into Raspberry Pi 3

    Needed the following to install it:

    sudo apt-get install libudev-dev
    sudo npm install --unsafe-perms -g espruino-web-ide
    

    But when I click Connect, I just get "Searching" in the ports popup. Tried with and without sudo. Also tried passing /dev/ttyACM0 as a parameter. No error printed out in terminal or inside the IDE's log.

    Any ideas?

  • Try espruino-web-ide --dbg - I think this should give you a debugger window on the right-hand side where you can see errors reported.

    I'd be 99% certain it's saying something like can't find serialport v47 - it's what happens when the version of node (node --version) doesn't match the version of electron, so the compiled libraries installed by npm don't work.

    Sadly it seems to be a major problem with both nw.js and electron, but it's usually just fixed by upgrading node.js

  • No joy with --dbg. Nothing new appeared.

    But Node versioning sounds like the problem alright. I'm on 4.4.0 (Raspbian ships with 0.10.x)

  • Actually I just looked at this a bit more and it seems that you can npm install electron-rebuild, run it, and then it'll rebuild everything for electron's version. That will probably sort it out for you...

    Looks like it can go in package.json so it all happens automatically, but I'm not 100% sure how to do that at the moment.

  • No joy with that but it may be user error. I'll try again later.

  • No success with starting back with completely clean slate (all node_modules and .node-gyp directories deleted) and just doing npm install espruino-web-ide. Now it won't even install.

    pi@raspberrypi:~ $ npm install espruino-web-ide
    npm WARN optional dep failed, continuing xpc-connection@0.1.4
    
    > nslog@3.0.0 install /home/pi/node_modules/espruino-web-ide/node_modules/electron-rebuild/node_modules/nslog
    > node-gyp rebuild
    
    make: Entering directory '/home/pi/node_modules/espruino-web-ide/node_modules/electron-rebuild/node_modules/nslog/build'
      CXX(target) Release/obj.target/nslog/src/main.o
      CXX(target) Release/obj.target/nslog/src/nslog_linux.o
      SOLINK_MODULE(target) Release/obj.target/nslog.node
      COPY Release/nslog.node
    make: Leaving directory '/home/pi/node_modules/espruino-web-ide/node_modules/electron-rebuild/node_modules/nslog/build'
    -
    > electron-prebuilt@0.36.11 postinstall /home/pi/node_modules/espruino-web-ide/node_modules/electron-prebuilt
    > node install.js
    
    |
    > usb@1.1.1 install /home/pi/node_modules/espruino-web-ide/node_modules/bleat/node_modules/noble/node_modules/bluetooth-hci-socket/node_modules/usb
    > node-pre-gyp install --fallback-to-build
    
    make: Entering directory '/home/pi/node_modules/espruino-web-ide/node_modules/bleat/node_modules/noble/node_modules/bluetooth-hci-socket/node_modules/usb/build'
      CC(target) Release/obj.target/libusb/libusb/libusb/core.o
      CC(target) Release/obj.target/libusb/libusb/libusb/descriptor.o
      CC(target) Release/obj.target/libusb/libusb/libusb/hotplug.o
      CC(target) Release/obj.target/libusb/libusb/libusb/io.o
      CC(target) Release/obj.target/libusb/libusb/libusb/strerror.o
      CC(target) Release/obj.target/libusb/libusb/libusb/sync.o
      CC(target) Release/obj.target/libusb/libusb/libusb/os/poll_posix.o
      CC(target) Release/obj.target/libusb/libusb/libusb/os/threads_posix.o
      CC(target) Release/obj.target/libusb/libusb/libusb/os/linux_usbfs.o
      CC(target) Release/obj.target/libusb/libusb/libusb/os/linux_udev.o
      AR(target) Release/obj.target/usb.a
      COPY Release/usb.a
      CXX(target) Release/obj.target/usb_bindings/src/node_usb.o
      CXX(target) Release/obj.target/usb_bindings/src/device.o
      CXX(target) Release/obj.target/usb_bindings/src/transfer.o
      SOLINK_MODULE(target) Release/obj.target/usb_bindings.node
      COPY Release/usb_bindings.node
      COPY /home/pi/node_modules/espruino-web-ide/node_modules/bleat/node_modules/noble/node_modules/bluetooth-hci-socket/node_modules/usb/src/binding/usb_bindings.node
      TOUCH Release/obj.target/action_after_build.stamp
    make: Leaving directory '/home/pi/node_modules/espruino-web-ide/node_modules/bleat/node_modules/noble/node_modules/bluetooth-hci-socket/node_modules/usb/build'
    
    > serialport@2.0.6 install /home/pi/node_modules/espruino-web-ide/node_modules/serialport
    > node-pre-gyp install --fallback-to-build
    
    make: Entering directory '/home/pi/node_modules/espruino-web-ide/node_modules/serialport/build'
      CXX(target) Release/obj.target/serialport/src/serialport.o
      CXX(target) Release/obj.target/serialport/src/serialport_unix.o
      CXX(target) Release/obj.target/serialport/src/serialport_poller.o
      SOLINK_MODULE(target) Release/obj.target/serialport.node
      COPY Release/serialport.node
      COPY /home/pi/node_modules/espruino-web-ide/node_modules/serialport/build/Release/node-v46-linux-arm/serialport.node
      TOUCH Release/obj.target/action_after_build.stamp
    make: Leaving directory '/home/pi/node_modules/espruino-web-ide/node_modules/serialport/build'
    
    > bluetooth-hci-socket@0.4.2 install /home/pi/node_modules/espruino-web-ide/node_modules/bleat/node_modules/noble/node_modules/bluetooth-hci-socket
    > node-gyp rebuild
    
    make: Entering directory '/home/pi/node_modules/espruino-web-ide/node_modules/bleat/node_modules/noble/node_modules/bluetooth-hci-socket/build'
      CXX(target) Release/obj.target/binding/src/BluetoothHciSocket.o
      SOLINK_MODULE(target) Release/obj.target/binding.node
      COPY Release/binding.node
    make: Leaving directory '/home/pi/node_modules/espruino-web-ide/node_modules/bleat/node_modules/noble/node_modules/bluetooth-hci-socket/build'
    
    > espruino-web-ide@0.60.4 install /home/pi/node_modules/espruino-web-ide
    > electron-rebuild
    
    
    > bluetooth-hci-socket@0.4.2 install /home/pi/node_modules/espruino-web-ide/node_modules/bleat/node_modules/noble/node_modules/bluetooth-hci-socket
    > node-gyp rebuild
    
    make: Entering directory '/home/pi/node_modules/espruino-web-ide/node_modules/bleat/node_modules/noble/node_modules/bluetooth-hci-socket/build'
      CXX(target) Release/obj.target/binding/src/BluetoothHciSocket.o
      SOLINK_MODULE(target) Release/obj.target/binding.node
      COPY Release/binding.node
    make: Leaving directory '/home/pi/node_modules/espruino-web-ide/node_modules/bleat/node_modules/noble/node_modules/bluetooth-hci-socket/build'
    
    > usb@1.1.1 install /home/pi/node_modules/espruino-web-ide/node_modules/bleat/node_modules/noble/node_modules/bluetooth-hci-socket/node_modules/usb
    > node-pre-gyp install --fallback-to-build
    
    Unknown Runtime: 'electron'
    
    node-pre-gyp ERR! install error
    node-pre-gyp ERR! stack Error: Unknown Runtime: 'electron'
    node-pre-gyp ERR! stack     at get_runtime_abi (/home/pi/node_modules/espruino-web-ide/node_modules/bleat/node_modules/noble/node_modules/bluetooth-hci-socket/node_modules/usb/node_modules/node-pre-gyp/lib/util/versioning.js:60:19)
    node-pre-gyp ERR! stack     at Object.module.exports.evaluate (/home/pi/node_modules/espruino-web-ide/node_modules/bleat/node_modules/noble/node_modules/bluetooth-hci-socket/node_modules/usb/node_modules/node-pre-gyp/lib/util/versioning.js:249:19)
    node-pre-gyp ERR! stack     at install (/home/pi/node_modules/espruino-web-ide/node_modules/bleat/node_modules/noble/node_modules/bluetooth-hci-socket/node_modules/usb/node_modules/node-pre-gyp/lib/install.js:138:31)
    node-pre-gyp ERR! stack     at Object.self.commands.(anonymous function) [as install] (/home/pi/node_modules/espruino-web-ide/node_modules/bleat/node_modules/noble/node_modules/bluetooth-hci-socket/node_modules/usb/node_modules/node-pre-gyp/lib/node-pre-gyp.js:48:37)
    node-pre-gyp ERR! stack     at run (/home/pi/node_modules/espruino-web-ide/node_modules/bleat/node_modules/noble/node_modules/bluetooth-hci-socket/node_modules/usb/node_modules/node-pre-gyp/bin/node-pre-gyp:79:30)
    node-pre-gyp ERR! stack     at Object.<anonymous> (/home/pi/node_modules/espruino-web-ide/node_modules/bleat/node_modules/noble/node_modules/bluetooth-hci-socket/node_modules/usb/node_modules/node-pre-gyp/bin/node-pre-gyp:131:1)
    node-pre-gyp ERR! stack     at Module._compile (module.js:409:26)
    node-pre-gyp ERR! stack     at Object.Module._extensions..js (module.js:416:10)
    node-pre-gyp ERR! stack     at Module.load (module.js:343:32)
    node-pre-gyp ERR! stack     at Function.Module._load (module.js:300:12)
    node-pre-gyp ERR! System Linux 4.1.18-v7+
    node-pre-gyp ERR! command "/usr/local/bin/node" "/home/pi/node_modules/espruino-web-ide/node_modules/bleat/node_modules/noble/node_modules/bluetooth-hci-socket/node_modules/usb/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
    node-pre-gyp ERR! cwd /home/pi/node_modules/espruino-web-ide/node_modules/bleat/node_modules/noble/node_modules/bluetooth-hci-socket/node_modules/usb
    node-pre-gyp ERR! node -v v4.4.0
    node-pre-gyp ERR! node-pre-gyp -v v0.6.4
    node-pre-gyp ERR! not ok
    
    npm ERR! Linux 4.1.18-v7+
    npm ERR! argv "/usr/local/bin/node" "/home/pi/node_modules/espruino-web-ide/node_modules/electron-rebuild/node_modules/npm/bin/npm-cli.js" "rebuild" "--runtime=electron" "--target=0.36.11" "--arch=arm"
    npm ERR! node v4.4.0
    npm ERR! npm  v3.8.1
    npm ERR! code ELIFECYCLE
    npm ERR! usb@1.1.1 install: `node-pre-gyp install --fallback-to-build`
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the usb@1.1.1 install script 'node-pre-gyp install --fallback-to-build'.
    npm ERR! Make sure you have the latest version of node.js and npm installed.
    npm ERR! If you do, this is most likely a problem with the usb package,
    npm ERR! not with npm itself.
    npm ERR! Tell the author that this fails on your system:
    npm ERR!     node-pre-gyp install --fallback-to-build
    npm ERR! You can get information on how to open an issue for this project with:
    npm ERR!     npm bugs usb
    npm ERR! Or if that isn't available, you can get their info via:
    npm ERR!     npm owner ls usb
    npm ERR! There is likely additional logging output above.
    
    npm ERR! Please include the following file with any support request:
    npm ERR!     /home/pi/node_modules/espruino-web-ide/node_modules/npm-debug.log
    
    Process exited with code: 1
    Error: Process exited with code: 1
        at ChildProcess.<anonymous> (/home/pi/node_modules/espruino-web-ide/node_modules/electron-rebuild/lib/spawn.js:55:26)
        at emitTwo (events.js:87:13)
        at ChildProcess.emit (events.js:172:7)
        at maybeClose (internal/child_process.js:827:16)
        at Socket.<anonymous> (internal/child_process.js:319:11)
        at emitOne (events.js:77:13)
        at Socket.emit (events.js:169:7)
        at Pipe._onclose (net.js:475:12)
    npm ERR! Linux 4.1.18-v7+
    npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "espruino-web-ide"
    npm ERR! node v4.4.0
    npm ERR! npm  v2.14.20
    npm ERR! code ELIFECYCLE
    
    npm ERR! espruino-web-ide@0.60.4 install: `electron-rebuild`
    npm ERR! Exit status 255
    npm ERR!
    npm ERR! Failed at the espruino-web-ide@0.60.4 install script 'electron-rebuild'.
    npm ERR! This is most likely a problem with the espruino-web-ide package,
    npm ERR! not with npm itself.
    npm ERR! Tell the author that this fails on your system:
    npm ERR!     electron-rebuild
    npm ERR! You can get information on how to open an issue for this project with:
    npm ERR!     npm bugs espruino-web-ide
    npm ERR! Or if that isn't available, you can get their info via:
    npm ERR!
    npm ERR!     npm owner ls espruino-web-ide
    npm ERR! There is likely additional logging output above.
    
    npm ERR! Please include the following file with any support request:
    npm ERR!     /home/pi/npm-debug.log
    
    
  • Try again now - I'd added some extra code that called electron-rebuild automatically as had been suggested on the net - but it looks like it's broken.

    (It seems to expect electron on the path, which is fine I guess if you installed it globally before, but it doesn't work for a simple npm install)

  • It now builds again but still no serial ports.

    I also tried

    sudo electron-rebuild --version 0.36.11
    

    giving

    Couldn't find electron-prebuilt and no --node-module-version parameter set, always rebuilding
    
    > nslog@3.0.0 install /usr/local/lib/node_modules/electron-rebuild/node_modules/nslog
    > node-gyp rebuild
    
    
    gyp ERR! clean error
    gyp ERR! stack Error: EACCES: permission denied, unlink 'build/Makefile'
    gyp ERR! stack     at Error (native)
    gyp ERR! System Linux 4.1.19-v7+
    gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/electron-rebuild/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
    gyp ERR! cwd /usr/local/lib/node_modules/electron-rebuild/node_modules/nslog
    gyp ERR! node -v v4.4.0
    gyp ERR! node-gyp -v v3.3.0
    gyp ERR! not ok
    
    npm ERR! Linux 4.1.19-v7+
    npm ERR! argv "/usr/local/bin/node" "/usr/local/lib/node_modules/electron-rebuild/node_modules/npm/bin/npm-cli.js" "rebuild" "--runtime=electron" "--target=0.36.11" "--arch=arm"
    npm ERR! node v4.4.0
    npm ERR! npm  v3.8.1
    npm ERR! code ELIFECYCLE
    npm ERR! nslog@3.0.0 install: `node-gyp rebuild`
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the nslog@3.0.0 install script 'node-gyp rebuild'.
    npm ERR! Make sure you have the latest version of node.js and npm installed.
    npm ERR! If you do, this is most likely a problem with the nslog package,
    npm ERR! not with npm itself.
    npm ERR! Tell the author that this fails on your system:
    npm ERR!     node-gyp rebuild
    npm ERR! You can get information on how to open an issue for this project with:
    npm ERR!     npm bugs nslog
    npm ERR! Or if that isn't available, you can get their info via:
    npm ERR!     npm owner ls nslog
    npm ERR! There is likely additional logging output above.
    
    npm ERR! Please include the following file with any support request:
    npm ERR!     /usr/local/lib/node_modules/npm-debug.log
    
    Process exited with code: 1
    Error: Process exited with code: 1
        at ChildProcess.<anonymous> (/usr/local/lib/node_modules/electron-rebuild/lib/spawn.js:55:26)
        at emitTwo (events.js:87:13)
        at ChildProcess.emit (events.js:172:7)
        at maybeClose (internal/child_process.js:827:16)
        at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
    

    I need to try on a non-RPi box to see if it's Pi or ARM specific.

  • Ahh - might be an idea. I haven't tried it on the Pi...

    If only someone could come up with a serial port library that didn't need native modules. I would have thought just opening the file /dev/ttyACM0 would be good enough - although maybe it's too hard to do on Windows and Mac as well.

  • Yeah it's a pain.

    Just FYI - Exact same behaviour/error as the last one above with Node 4.2.6 on Fedora 23 x86-64 in a VBox VM.

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

Espruino Web IDE on NPM (with Electron)

Posted by Avatar for Gordon @Gordon

Actions