Closed mercoglianoisidoro closed 4 years ago
What platform are you on? And do you need Bluetooth, or serial?
Can you just try installing node-serialport and see if that fails? If it does I'd report the issue there.
We've had a bunch of trouble with node 10 - it seems the Bluetooth and serial port libraries are broken (i thought they were fixed my now though) - so the safest option is just to move back to node 8
I'm running ubuntu 18.. I managed to get the install to work I like this...
sudo npm install espruino -g --build-from-source --unsafe-perm
I get a bluetooth related error/ warning:
binding.target.mk:101: recipe for target 'Release/obj.target/binding/src/BluetoothHciSocket.o' failed
make: *** [Release/obj.target/binding/src/BluetoothHciSocket.o] Error 1
make: Leaving directory '/usr/lib/node_modules/espruino/node_modules/bluetooth-hci-socket/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
But things seem to work if I then always make sure to pass the no bluetooth flag...
sudo espruino -p /dev/ttyACM0 ./test.js --no-ble
Espruino Command-line Tool 0.1.23
-----------------------------------
Connecting to '/dev/ttyACM0'
(node:16035) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(.
Connected
--]
--] ____ _
--] | __|___ ___ ___ _ _|_|___ ___
--] | __|_ -| . | _| | | | | . |
--] |____|___| _|_| |___|_|_|_|___|
--] |_| espruino.com
--] 2v01 (c) 2018 G.Williams
--]
--] >44
Running --list without --no-ble gives me an empty list... with the --no-ble flag I see connected boards. This may be useful to others who use linux and do not have Bluetooth working or dont have a Bluetooth drivers that supports BLE.
Thanks for the update! What happens without --no-ble
? Could you try and post a stack trace?
If EspruinoTools can be made to trap the error and carry on without BLE that'd obviously be better than it just not working.
Although obviously bluetooth-hci-socket
working with Node 10 would be preferable!
I get no errors without the ble flag but also it doesnt work... using -v reveals that the issue it is related to bluetooth-hci-socket
not being installing.
espruino -p /dev/ttyACM0 ./fade.js -v
0.1.23
Espruino Command-line Tool 0.1.23
-----------------------------------
Acorn library not found - you'll need it for compiled code
Found /usr/lib/node_modules/espruino/espruino.js
Found /usr/lib/node_modules/espruino/core/codeWriter.js
Found /usr/lib/node_modules/espruino/core/config.js
Found /usr/lib/node_modules/espruino/core/env.js
Found /usr/lib/node_modules/espruino/core/flasher.js
Found /usr/lib/node_modules/espruino/core/modules.js
Found /usr/lib/node_modules/espruino/core/notifications.js
Found /usr/lib/node_modules/espruino/core/serial.js
Found /usr/lib/node_modules/espruino/core/serial_chrome_serial.js
No chrome.serial - Chrome Serial disabled
Found /usr/lib/node_modules/espruino/core/serial_chrome_socket.js
No chrome.sockets - Chrome Socket disabled
Found /usr/lib/node_modules/espruino/core/serial_frame.js
Found /usr/lib/node_modules/espruino/core/serial_noble.js
Found /usr/lib/node_modules/espruino/core/serial_node_serial.js
Found /usr/lib/node_modules/espruino/core/serial_node_socket.js
Found /usr/lib/node_modules/espruino/core/serial_web_audio.js
Found /usr/lib/node_modules/espruino/core/serial_web_bluetooth.js
Found /usr/lib/node_modules/espruino/core/serial_websocket_local.js
Found /usr/lib/node_modules/espruino/core/serial_websocket_relay.js
Found /usr/lib/node_modules/espruino/core/serial_winnus.js
Not on Windows, Winnus not needed
Found /usr/lib/node_modules/espruino/core/terminal.js
Found /usr/lib/node_modules/espruino/core/utils.js
Found /usr/lib/node_modules/espruino/plugins/assembler.js
Found /usr/lib/node_modules/espruino/plugins/boardJSON.js
Found /usr/lib/node_modules/espruino/plugins/compiler.js
Found /usr/lib/node_modules/espruino/plugins/getGitHub.js
Found /usr/lib/node_modules/espruino/plugins/localModules.js
Found /usr/lib/node_modules/espruino/plugins/minify.js
Found /usr/lib/node_modules/espruino/plugins/saveOnSend.js
Found /usr/lib/node_modules/espruino/plugins/setTime.js
Found /usr/lib/node_modules/espruino/plugins/unicode.js
Found /usr/lib/node_modules/espruino/plugins/versionChecker.js
Initialising CodeWriter
Initialising Config
Initialising Env
Initialising Flasher
Initialising Modules
Initialising Notifications
Initialising Serial
- Initialising Serial Noble Bluetooth LE
- Initialising Serial Node Serial
- Initialising Serial Node Socket
- Initialising Serial Web Bluetooth
Initialising Utils
Initialising Status
Initialising Assembler
Initialising BoardJSON
Initialising Compiler
Initialising GetGitHub
Initialising LocalModules
Initialising Minify
Initialising SaveOnSend
Initialising SetTime
Initialising Unicode
Initialising VersionChecker
Connecting to '/dev/ttyACM0'
Noble: module couldn't be loaded, no node.js Bluetooth Low Energy
{ Error: Cannot find module 'bluetooth-hci-socket'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
at Function.Module._load (internal/modules/cjs/loader.js:508:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/usr/lib/node_modules/espruino/node_modules/noble/lib/hci-socket/hci.js:6:26)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3) code: 'MODULE_NOT_FOUND' }
Noble: getPorts - not initialised
No navigator.bluetooth - Web Bluetooth not enabled
Incidentally I did install this too
apt-get install libudev-dev
in response too an error during installation I saw...
Getting "fatal error: libudev.h: No such file or directory #include <libudev.h>" when compiling the package
Which may have helped during the npm install phase.
I have an issue running the watch flag -w
eg.. espruino -p /dev/ttyACM0 -w ./test.js --no-ble
. I think the expected behavior is that I should be able to type things directly into the console as If I was using chrome-app left hand console after the code has uploaded (correct me if I'm wrong). It seems to freeze and then direct the characters to stdout so that when I exit those characters appear in the shell.
To work around this I use screen in one terminal and avoid using the -w flag uploading code in a different terminal and everything works fine.
screen /dev/ttyACMO 9600
Try updating from npm now - I think I at least fixed it so that if Noble fails to initialise then it keeps going on serial.
Honestly not sure what to suggest about -w
. I'm on Linux here with Node 8 and that command works great for me
I am trying node 8 and I'm testing things out but dealing with some NPM hanging issues now : )
There are some packages on NPM that are much simpler but they are 5 years old now and I don't know if they work with all the latest boards. The use case I have on linux is just uploading and seeing console output from the command line. I reckon a smaller package for that will be useful as not everyone needs all the functionality that the chrome app and EspruinoTools provides.
I may have a go working on a much smaller cli tool for these purposes.
PS. All my boards now work with the chrome app now so I'm happy!
Sorry for the long reply and great work as always!
There are some packages on NPM that are much simpler
They don't work reliably - try uploading:
if (false) console.log("No")
else console.log("Yes");
I think pretty much all will fail, and I can point to loads of other cases.
Please don't make your own because it'll just add to the pile of out of date broken tools out there that confuse people.
EspruinoTools is actually pretty lightweight, and is designed to work with only the stuff you need (serial, TCPIP or Bluetooth). The issue you hit was just a bug - if you didn't have noble installed it'd have been fine - it was having a broken install of noble that caused the issue.
So currently there's no support for BLE on Node.js 10 or 11? I'm trying to get a CLI working with a Puck.js and have been dealing with compile errors trying to install it.
So currently there's no support for BLE on Node.js 10 or 11?
Which OS are you on?
noble
is the main way to get Bluetooth LE on Node.js, and Node 10 changed something which meant that it broke. I keep thinking 'it'll be fixed soon' and it isn't (it hasn't been updated for a year) - I'll ask one of the maintainers what the situation is.
It looks like you may be able to use this version of noble though: https://www.npmjs.com/package/@abandonware/noble
I have similar problem:
installing by: npm install espruino -g --build-from-source --unsafe-perm
OS -> Windows 10, Node -> 10.14.1
just an update, my installation problem was solved by installing before:
npm install windows-build-tools -g
then
npm install espruino -g
Thanks! I'll add that as a dependency on winnus, which should hopefully fix this?
Just to add though - even if winnus
fails, the tools should still be able to work with serial and with Bluetooth LE radios in HCI mode using noble
Dependency added in https://github.com/espruino/winnus/commit/b33e503b2f13294c6be00c6ac1c7c0ea8913dd88 - closing
Hello, I am having problem during espruino installation. After the command:
sudo npm i -g espruino
Here the result:
I checked a lot, it's not a problem of right access. The espruino command result installed, but it can't find any devices.
Node version is: v10.6.0
Thank, Isidoro.