Skip to content
This repository has been archived by the owner on Feb 25, 2020. It is now read-only.

Installing dependencies fails #57

Open
viktor-ferenczi opened this issue Aug 29, 2015 · 3 comments
Open

Installing dependencies fails #57

viktor-ferenczi opened this issue Aug 29, 2015 · 3 comments

Comments

@viktor-ferenczi
Copy link

OS: Windows 10

C:\Users\Viktor\Documents\spark-server>npm install
-


> ursa@0.8.5 install C:\Users\Viktor\Documents\spark-server\node_modules\ursa
> node-gyp rebuild

\
C:\Users\Viktor\Documents\spark-server\node_modules\ursa>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.j
s" rebuild )  else (node  rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
MSBUILD : error MSB4132: The tools version "2.0" is unrecognized. Available tools versions are "4.0".
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:269:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Viktor\Documents\spark-server\node_modules\ursa
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
npm ERR! code ELIFECYCLE

npm ERR! ursa@0.8.5 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ursa@0.8.5 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the ursa 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 their info via:
npm ERR!     npm owner ls ursa
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\Viktor\Documents\spark-server\npm-debug.log

C:\Users\Viktor\Documents\spark-server>
@chuank
Copy link

chuank commented Sep 4, 2015

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

@tenaciousRas
Copy link

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.

@tenaciousRas
Copy link

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
  4. sudo apt-get install gcc-4.7 g++-4.7
  5. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.6
  6. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.7
  7. sudo update-alternatives --config gcc
  8. choose gcc version 4.7
  9. 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:

  • Edit dependency versions in spark-server/package.json
    -- modify "dependencies": "ursa": "", "when": "", "moment": "", "xtend": "", "request": "*"
    -- may also have to modify the stated version for express, ~3.4.4 works with this node/npm/node-gyp version

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.

straccio pushed a commit to straccio/spark-server that referenced this issue Jun 13, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants