小编典典

npm install,node-gyp只能在两台相同的计算机之一上生成错误

jenkins

我正在尝试在Ubuntu 14.04 VPS上运行npm install,但是在安装业力方面一直失败。当我以jenkins用户身份登录时,命令npm
install从Jenkins构建步骤执行,但是从命令行也失败。Jenkins服务器通过Capistrano调用另一个VPS(生产服务器)上的部署,据我所知,该部署与第一个VPS完全一样。

奇怪的是,在生产服务器(第二个VPS)上部署后,npm install也将运行,并且在这里运行良好。

这是错误:

ws@0.5.0安装/var/lib/jenkins/workspace/bitbuilders-
cms/node_modules/karma/node_modules/socket.io/node_modules/engine.io/node_modules/ws(node-
gyp重建2> builderror.log)| | (出口0)被杀

当我在此目录中检查builderror.log时,它说:

In file included from ../src/bufferutil.cc:15:0:
../node_modules/nan/nan.h: In function 'v8::Local<v8::Signature> NanNew(v8::Handle<v8::FunctionTemplate>, int, v8::Handle<v8::FunctionTemplate>*)':
../node_modules/nan/nan.h:207:78: error: no matching function for call to 'v8::Signature::New(v8::Isolate*, v8::Handle<v8::FunctionTemplate>&, int&, v8::Handle<v8::FunctionTemplate>*&)'
 return v8::Signature::New(v8::Isolate::GetCurrent(), receiver, argc, argv);
                                                                          ^
../node_modules/nan/nan.h:207:78: note: candidate is:
In file included from ../src/bufferutil.cc:7:0:
/var/lib/jenkins/.node-gyp/2.0.2/deps/v8/include/v8.h:4188:27: note: static v8::Local<v8::Signature> v8::Signature::New(v8::Isolate*, v8::Handle<v8::FunctionTemplate>)
   static Local<Signature> New(
                       ^
/var/lib/jenkins/.node-gyp/2.0.2/deps/v8/include/v8.h:4188:27: note:       candidate expects 2 arguments, 4 provided
../src/bufferutil.cc: In static member function 'static void BufferUtil::Initialize(v8::Handle<v8::Object>)':
../src/bufferutil.cc:32:17: warning: 'v8::Local<v8::String> NanSymbol(const char*, int)' is deprecated (declared at ../node_modules/nan/nan.h:616) [-Wdeprecated-declarations]
 target->Set(NanSymbol("BufferUtil"), t->GetFunction());
             ^
../src/bufferutil.cc:32:39: warning: 'v8::Local<v8::String> NanSymbol(const char*, int)' is deprecated (declared at ../node_modules/nan/nan.h:616) [-Wdeprecated-declarations]
 target->Set(NanSymbol("BufferUtil"), t->GetFunction());
                                   ^
make: *** [Release/obj.target/bufferutil/src/bufferutil.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/var/lib/jenkins/.nvm/versions/io.js/v2.0.2/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:269: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 (child_process.js:1009:12)
gyp ERR! System Linux 3.2.0-56-generic
gyp ERR! command "/var/lib/jenkins/.nvm/versions/io.js/v2.0.2/bin/iojs" "/var/lib/jenkins/.nvm/versions/io.js/v2.0.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /var/lib/jenkins/workspace/bitbuilders-cms/node_modules/karma/node_modules/socket.io/node_modules/engine.io/node_modules/ws
gyp ERR! node -v v2.0.2
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok

当我运行node-gyp重建时,它会提供相同的输出。

同样,在另一台计算机上它运行正常。

它们都运行:

  • Ubuntu 14.04
  • io.js 2.0.2
  • npm 2.9.0
  • GNU Make 3.81
  • python 2.7.6
  • gcc 4.8.2
  • 节点gyp 1.0.3
  • 虚拟机0.25.2

到目前为止我尝试过的

我全局安装了node-gyp(npm install -g node-gyp)并运行了0.12.3节点。在安装之前,我运行了:

  • npm缓存清理
  • rm -rf node_modules
  • rm -rf〜/ .node-gyp

在npm install出现此错误的VPS上,我无法在后面运行任何gulp任务,因为它抱怨找不到特定的npm模块。在此计算机上,npm
install以用户jenkins的身份运行。

在其他npm install正常运行的VPS上,后续的gulp任务也可以正常运行。在这台机器上,npm
install是通过Capistrano以用户www-data的身份执行的。它们都使用shell / bin / bash。

不幸的是,问题仍然存在。

这是怎么了?任何帮助是极大的赞赏!


阅读 323

收藏
2020-07-25

共1个答案

小编典典

npm install通过Jenkins在VM上成功运行Karma和Karma
之后,我得出的结论是,在VPS上必须严重破坏某些东西,这给我带来了麻烦。我重新安装了Ubuntu 14.04,其余的安装在VPS上,现在一切正常。

我还注意到,重新安装后,我不需要显式启动ssh-agent并添加我的ssh密钥(eval ssh-agent -sssh-add [key])即可开始在生产服务器上进行部署。也许这根本没有关系,但是如果有人遇到类似问题,这可能会有所帮助。

更新:
另外,我发现有人遇到同样问题的帖子。解决方案似乎是增加交换文件的大小。我没有尝试过,但这可能是正确的解决方案:https :
//www.digitalocean.com/community/questions/npm-gets-killed-no-matter-
what?answer=18115

2020-07-25