Even later: There is a better solution which works and is tested by me on Ubuntu 12.04 - it may also work on other Ubuntu releases. See
Later: (I’ve hit the newbie’s 5 posts per thread limit so I’m adding to this post, at the top.) I’ve seemingly addressed the install issue identified below by doing this:
cd /usr/bin
sudo ln -s nodejs node
Watch out - you may already have a /usr/bin/node from another (amateur radio?) package.
I’m not sure the install completed successfully but no problems were reported. I also did
sudo npm -g uninstall spark-cli
sudo npm -g install spark-cli
Earlier: I’m confused about your advise re installing from tarballs or via git. Is that in addition to or instead of ‘apt-get install npm’?
I’ve now tried Ubuntu 13.04 - it’s still only provides npm 0.6 - so doesn’t work. I’ve upgraded one of my boxes to 13.10 and yes all seems to progress well, much newer versions of npm and nodejs are installed, but just as it looks as if “sudo npm -g install spark-clu” is about to complete there is a problem: the relevant output follows. There is a suggestion there is a problem with the serialport module. (I’ve checked as prompted by the below - there is no binary ‘node’ on my system - legacy or not!)
serialport@1.3.1 install /usr/local/lib/node_modules/spark-cli/node_modules/serialport
node-gyp rebuild
/bin/sh: 1: node: not found
gyp: Call to 'node -e "require('nan')"' returned exit status 127. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/share/node-gyp/lib/configure.js:431:16)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Linux 3.11.0-18-generic
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/spark-cli/node_modules/serialport
gyp ERR! node -v v0.10.15
gyp ERR! node-gyp -v v0.10.9
gyp ERR! not ok
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR! serialport@1.3.1 install: `node-gyp rebuild`
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 1
npm ERR!
npm ERR! Failed at the serialport@1.3.1 install script.
npm ERR! This is most likely a problem with the serialport 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 serialport
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.11.0-18-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "-g" "install" "spark-cli"
npm ERR! cwd /home/psb
npm ERR! node -v v0.10.15
npm ERR! npm -v 1.2.18
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/psb/npm-debug.log
npm ERR! not ok code 0