Open viktor-ferenczi opened 9 years ago
in your trace, you're using node v12.7.
use node v10.40 instead – spark-server
as of current status only runs on node v10.
this should resolve issues with the ursa
module.
https://community.particle.io/t/local-cloud-on-raspberry-pi/5708/69
Several points for the Particle team: 1) Is this documented somewhere? Chasing around different versions of NodeJS is a waste of time. A response in a bug report is not sufficient. 2) Specify an engine in package.json and avoid this entire thread! http://blog.nodejitsu.com/package-dependencies-done-right/ 3) URSA versioning on Github is out-of-sync with NPM. How many other NPM packages like this? 4) TDD 5) NodeJS = fail. Java/Scala for the win.
Actually, it will install and run under a newer version of NodeJS - just takes some TLC to make it work.
FWIW I've found it easiest to use "n" to switch between NodeJS versions. I've only tried the official repo and "n" versions of node. N makes it easy to switch versions.
I have spark-server running on NodeJS 4.2.2, NPM 2.14.7, Raspbian Wheezy. The keys to make this happen are this: (optional) on an RPi I ran sudo rpi-update to update the RPi-v1 firmware. I basically followed the steps at https://github.com/Hexxeh/rpi-update, but I ran apt-get update and apt-get upgrade (sudo) first. Then the device was rebooted before proceeding. 1) sudo apt-get update; sudo apt-get upgrade; sudo apt-get dist-upgrade (again, if just updated rpi firmware) 2) sudo npm install -g n; n ls 3) sudo n 4.2.2 2) sudo apt-get install gcc-4.7 g++-4.7 3) sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.6 4) sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.7 5) sudo update-alternatives --config gcc 6) choose gcc version 4.7 7) verify installation: gcc --version; g++ --version
Now install spark-server with npm --verbose -g install spark-server. However, it will fail until you make these edits:
Also particle-cli installs and runs with this version of nodejs. To get this to happen I needed similar edits to package.json; and on Wheezy I built dfu-util from (github) source to obtain version 0.8.
FWIW - I'm not sure but I think the rumors/reports of problems with URSA and Crypto are due to V8 versions. NodeJS runs on V8. NodeJS v0.10 does not support ECMAScript6 because it only runs on an older V8 engine. NodeJS 0.12+ supports V8 engines with ECMA6 support. The V8V package is unreliable for investigating this.
They appear to run as they should, but !Proceed With Caution! I'm not 100% confident yet because I have to re-issue keys and reclaim photon.
Follow up: spark-server seems to work fine. BACKUP spark-server/user -- I ran into problems because I accidentally nuked it. Beware Express 4.x and node-oauth 2.x do not work in package.json without code-rework.
OS: Windows 10