So I wanted to build this nodejs tool in Raspbian. So as the instructions say I need to npm install
I go ahead and install node with apt-get:
sudo apt-get install nodejs npm
Then I try to compile/install, and I get this error:
$ npm install
> configure@0.0.1 install /home/pi/Documents/Code/buzzerbot9000/node_modules/configure
> node install.js
sh: 1: node: not found
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! configure@0.0.1 install: `node install.js`
npm ERR! Exit status 127
So apparently the installation of nodejs package didn't create any node
command available globally. Then I look for it via apt-file:
$ apt-file search /usr/bin/node
clustershell: /usr/bin/nodeset
genders: /usr/bin/nodeattr
lbdb: /usr/bin/nodelist2lbdb
node-gyp: /usr/bin/node-gyp
node-static: /usr/bin/node-static
nodejs: /usr/bin/nodejs
nodejs-dbg: /usr/lib/debug/usr/bin/nodejs
nodejs-legacy: /usr/bin/node
noweb: /usr/bin/nodefs
osm2pgsql: /usr/bin/nodecachefilereader
So, I guess I need to install nodejs-legacy
, I do that, and I get the important error to be highlighted here:
$ npm install
-
> configure@0.0.1 install /home/pi/Documents/Code/buzzerbot9000/node_modules/configure
> node install.js
-
> sqlite3@3.1.0 install /home/pi/Documents/Code/buzzerbot9000/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build
make: Entering directory '/home/pi/Documents/Code/buzzerbot9000/node_modules/sqlite3/build'
ACTION deps_sqlite3_gyp_action_before_build_target_unpack_sqlite_dep Release/obj/gen/sqlite-autoconf-3081101/sqlite3.c
TOUCH Release/obj.target/deps/action_before_build.stamp
CC(target) Release/obj.target/sqlite3/gen/sqlite-autoconf-3081101/sqlite3.o
AR(target) Release/obj.target/deps/sqlite3.a
COPY Release/sqlite3.a
CXX(target) Release/obj.target/node_sqlite3/src/database.o
In file included from ../src/database.h:10:0,
from ../src/database.cc:4:
../node_modules/nan/nan.h:316:47: error: ‘REPLACE_INVALID_UTF8’ is not a member of ‘v8::String’
static const unsigned kReplaceInvalidUtf8 = v8::String::REPLACE_INVALID_UTF8;
^
node_sqlite3.target.mk:98: recipe for target 'Release/obj.target/node_sqlite3/src/database.o' failed
make: *** [Release/obj.target/node_sqlite3/src/database.o] Error 1
make: Leaving directory '/home/pi/Documents/Code/buzzerbot9000/node_modules/sqlite3/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/share/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:809:12)
gyp ERR! System Linux 4.1.7-v7+
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "build" "--fallback-to-build" "--module=/home/pi/Documents/Code/buzzerbot9000/node_modules/sqlite3/lib/binding/node-v11-linux-arm/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/home/pi/Documents/Code/buzzerbot9000/node_modules/sqlite3/lib/binding/node-v11-linux-arm"
gyp ERR! cwd /home/pi/Documents/Code/buzzerbot9000/node_modules/sqlite3
gyp ERR! node -v v0.10.29
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp build --fallback-to-build --module=/home/pi/Documents/Code/buzzerbot9000/node_modules/sqlite3/lib/binding/node-v11-linux-arm/node_sqlite3.node --module_name=node_sqlite3 --module_path=/home/pi/Documents/Code/buzzerbot9000/node_modules/sqlite3/lib/binding/node-v11-linux-arm' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/home/pi/Documents/Code/buzzerbot9000/node_modules/sqlite3/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:98:17)
node-pre-gyp ERR! stack at maybeClose (child_process.js:755:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:822:5)
node-pre-gyp ERR! System Linux 4.1.7-v7+
node-pre-gyp ERR! command "node" "/home/pi/Documents/Code/buzzerbot9000/node_modules/sqlite3/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/pi/Documents/Code/buzzerbot9000/node_modules/sqlite3
node-pre-gyp ERR! node -v v0.10.29
node-pre-gyp ERR! node-pre-gyp -v v0.6.10
node-pre-gyp ERR! not ok
Failed to execute 'node-gyp build --fallback-to-build --module=/home/pi/Documents/Code/buzzerbot9000/node_modules/sqlite3/lib/binding/node-v11-linux-arm/node_sqlite3.node --module_name=node_sqlite3 --module_path=/home/pi/Documents/Code/buzzerbot9000/node_modules/sqlite3/lib/binding/node-v11-linux-arm' (1)
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! sqlite3@3.1.0 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sqlite3@3.1.0 install script.
npm ERR! This is most likely a problem with the sqlite3 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 their info via:
npm ERR! npm owner ls sqlite3
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 4.1.7-v7+
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /home/pi/Documents/Code/buzzerbot9000
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/pi/Documents/Code/buzzerbot9000/npm-debug.log
npm ERR! not ok code 0
I've googled for this and apparently it's because of having an old version of something (see for example this other question).
So, what should I really upgrade here, and in what way (should I uninstall the debian package first and use npm? I'm lost). Please explain it like to a 5 year old because I'm new to node.