【问题标题】:Can I run NPM/NodeJS app on Debian running 8 on OpenVZ?我可以在 OpenVZ 上运行 8 的 Debian 上运行 NPM/NodeJS 应用程序吗?
【发布时间】:2016-04-07 20:44:29
【问题描述】:

我想在我的 Debian 8 VPS 上运行 Rocketchat(一个 nodejs 应用程序)。这个VPS运行在OpenVZ上,所以内核版本是2.6.32-042stab108.8。 按照 nodejs 网站(他们自己的仓库,而不是 debian 提供的仓库)上的描述安装 NodeJS 没有问题。

但是,当我运行时

npm install

NPM 无法安装所需的包并打印以下内容:

npm WARN package.json meteor-dev-bundle@0.0.0 No description
npm WARN package.json meteor-dev-bundle@0.0.0 No repository field.
npm WARN package.json meteor-dev-bundle@0.0.0 No README data
npm WARN package.json meteor-dev-bundle@0.0.0 No license field.
\
> fibers@1.0.5 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! fibers@1.0.5 install: `node ./build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the fibers@1.0.5 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

是不是因为内核太旧了?一种特定类型的虚拟化使 nodejs 无法使用似乎很奇怪。

编辑:包括完整的 npm 安装输出

Edit2:编译器版本为 gcc-4.9、g++-4.9

【问题讨论】:

  • 您安装了 c 编译器吗? 'make' 表明它正在尝试为我构建一些 c 代码。
  • 是的,gcc 已安装。

标签: node.js npm openvz


【解决方案1】:

我想通了。

首先,不——OpenVZ所需的内核版本与此无关。

这就是发生的事情。我尝试安装的 nodeJS 应用程序(Rocket.Chat)是使用 Meteor 框架构建的。显然,Meteor only works on NodeJS v0.10.40。 Debian 8 存储库只有 v4.4.2 和 v0.10.29,nodejs 网站has instructions 用于 v4 和 v5。

如果您遇到此问题,我的建议是通过node version manager 安装节点 v0.10.40。完成后,npm install 将像宣传的那样工作。

【讨论】:

  • 如果任何新读者可能认为它现在已经被一些更新的版本修复了,它不是。我对这个解决方案持怀疑态度,但是一旦我安装了node v0.10.40,它就立即起作用了。
猜你喜欢
  • 2019-08-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-10-04
  • 2018-12-08
  • 2022-06-15
  • 2014-08-19
相关资源
最近更新 更多