Search code examples
node.jsnpmopenvz

Can I run NPM/NodeJS app on Debian running 8 on OpenVZ?


I want to run rocketchat (a nodejs app) on my Debian 8 VPS. This VPS runs on OpenVZ, so the kernel version is 2.6.32-042stab108.8. Installing NodeJS as described on nodejs website (their own repo, not the one provided by debian) works without a problem.

However, when i run

npm install

NPM fails to install required packages and prints the following:

npm WARN package.json [email protected] No description
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data
npm WARN package.json [email protected] No license field.
\
> [email protected] install /home/rocketchat/rchat/programs/server/node_modules/fibers
> node ./build.js
(node) child_process: options.customFds option is deprecated. Use options.stdio instead.
make: Entering directory '/home/rocketchat/rchat/programs/server/node_modules/fibers/build'
  CXX(target) Release/obj.target/fibers/src/fibers.o
../src/fibers.cc: In function 'v8::Handle<v8::Signature> uni::NewSignature(v8::Isolate*, v8::Handle<v8::FunctionTemplate>, int, v8::Handle<v8::FunctionTemplate>*)':
../src/fibers.cc:132:54: error: no matching function for call to 'v8::Signature::New(v8::Isolate*&, v8::Handle<v8::FunctionTemplate>&, int&, v8::Handle<v8::FunctionTemplate>*&)'
   return Signature::New(isolate, receiver, argc, argv);
                                                      ^
../src/fibers.cc:132:54: note: candidate is:
In file included from /home/rocketchat/.node-gyp/4.4.2/include/node/node.h:42:0,
                 from ../src/coroutine.h:1,
                 from ../src/fibers.cc:1:
/home/rocketchat/.node-gyp/4.4.2/include/node/v8.h:4675:27: note: static v8::Local<v8::Signature> v8::Signature::New(v8::Isolate*, v8::Local<v8::FunctionTemplate>)
   static Local<Signature> New(
                           ^
/home/rocketchat/.node-gyp/4.4.2/include/node/v8.h:4675:27: note:   candidate expects 2 arguments, 4 provided
../src/fibers.cc: In function 'void uni::SetResourceConstraints(v8::Isolate*, v8::ResourceConstraints*)':
../src/fibers.cc:140:3: error: 'SetResourceConstraints' is not a member of 'v8'
   v8::SetResourceConstraints(isolate, constraints);
   ^
../src/fibers.cc:140:3: note: suggested alternative:
../src/fibers.cc:139:7: note:   'uni::SetResourceConstraints'
  void SetResourceConstraints(Isolate* isolate, ResourceConstraints* constraints) {
       ^
../src/fibers.cc: In function 'v8::Handle<v8::Signature> uni::NewSignature(v8::Isolate*, v8::Handle<v8::FunctionTemplate>, int, v8::Handle<v8::FunctionTemplate>*)':
../src/fibers.cc:133:2: warning: control reaches end of non-void function [-Wreturn-type]
  }
  ^
fibers.target.mk:97: recipe for target 'Release/obj.target/fibers/src/fibers.o' failed
make: *** [Release/obj.target/fibers/src/fibers.o] Error 1
make: Leaving directory '/home/rocketchat/rchat/programs/server/node_modules/fibers/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:276:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 2.6.32-042stab108.8
gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release"
gyp ERR! cwd /home/rocketchat/rchat/programs/server/node_modules/fibers
gyp ERR! node -v v4.4.2
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok 
Build failed
npm ERR! Linux 2.6.32-042stab108.8
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "--build-from-source"
npm ERR! node v4.4.2
npm ERR! npm  v2.15.0
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node ./build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node ./build.js'.
npm ERR! This is most likely a problem with the fibers package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node ./build.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs fibers
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! 
npm ERR!     npm owner ls fibers
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/rocketchat/rchat/programs/server/npm-debug.log

Does it happen because the kernel is too old? It just seems strange that a specific type of virtualization makes nodejs unusable.

Edit: included full npm install output

Edit2: Compiler versions are gcc-4.9, g++-4.9


Solution

  • I figured it out.

    First of all, no - the kernel version required by OpenVZ has nothing to do with this.

    Here's what happened. The nodeJS app I tried to install (Rocket.Chat) was built with a Meteor framework. Apparently, Meteor only works on NodeJS v0.10.40. Debian 8 repositories only has v4.4.2 and v0.10.29, nodejs website has instructions for v4 and v5.

    If you encounter this issue, my advice is to install node v0.10.40 via node version manager. Once it is done, npm install will work as advertised.