使用Visual Studio 2013构建节点上下文

时间:2015-10-12 13:36:57

标签: node.js

我正试图在我的机器上建立“contextify”。它是一台Windows 10机器。

我正在使用Windows 10

我安装了Visual Studio 2013 Professional。

我有python 2.7.10,它在我的路径中。

我安装了节点4.1.2 32位(我之前尝试过使用64位,这是节点网站要我下载的默认设置,但似乎没有区别)。

我不知道正确的步骤顺序是什么,我对node-gyp,npm等一无所知,我只是想构建一个依赖于contextify的项目。

我已经完成了从git hub克服了contextify repo并且天真地运行了   `npm install'。我正在使用Visual Studio命令提示符(VS2013 x64本机工具命令提示符或VS2013 x86本机工具命令提示符,没有任何区别)。

我得到的是:

d:\work\contextify>npm install

> contextify@0.1.14 install d:\work\contextify
> node-gyp rebuild


d:\work\contextify>if not defined npm_config_node_gyp (node "C:\Users\tomq\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  contextify.cc
d:\work\contextify\node_modules\nan\nan.h(263): error C2995: 'v8::Local<T> _NanEnsureLocal(v8::Local<T>)' : function te
mplate has already been defined [d:\work\contextify\build\contextify.vcxproj]
          d:\work\contextify\node_modules\nan\nan.h(256) : see declaration of '_NanEnsureLocal'
d:\work\contextify\node_modules\nan\nan.h(661): error C3083: 'smalloc': the symbol to the left of a '::' must be a type
 [d:\work\contextify\build\contextify.vcxproj]
d:\work\contextify\node_modules\nan\nan.h(661): error C2039: 'FreeCallback' : is not a member of 'node' [d:\work\contex
tify\build\contextify.vcxproj]
d:\work\contextify\node_modules\nan\nan.h(661): error C2061: syntax error : identifier 'FreeCallback' [d:\work\contexti
fy\build\contextify.vcxproj]
d:\work\contextify\node_modules\nan\nan.h(665): error C2065: 'callback' : undeclared identifier [d:\work\contextify\bui
ld\contextify.vcxproj]
d:\work\contextify\node_modules\nan\nan.h(665): error C2065: 'hint' : undeclared identifier [d:\work\contextify\build\c
ontextify.vcxproj]
d:\work\contextify\node_modules\nan\nan.h(672): error C2665: 'node::Buffer::New' : none of the 4 overloads could conver
t all the argument types [d:\work\contextify\build\contextify.vcxproj]
          C:\Users\tomq\.node-gyp\4.1.2\include\node\node_buffer.h(43): could be 'v8::MaybeLocal<v8::Object> node::Buff
  er::New(v8::Isolate *,char *,size_t)'
          C:\Users\tomq\.node-gyp\4.1.2\include\node\node_buffer.h(31): or       'v8::MaybeLocal<v8::Object> node::Buff
  er::New(v8::Isolate *,v8::Local<v8::String>,node::encoding)'
          while trying to match the argument list '(v8::Isolate *, const char *, uint32_t)'
d:\work\contextify\node_modules\nan\nan.h(676): error C2664: 'v8::Local<v8::Object>::Local(const v8::Local<v8::Object>
&)' : cannot convert argument 1 from 'v8::MaybeLocal<v8::Object>' to 'const v8::Local<v8::Object> &' [d:\work\contextif
y\build\contextify.vcxproj]
          Reason: cannot convert from 'v8::MaybeLocal<v8::Object>' to 'const v8::Local<v8::Object>'
          No user-defined-conversion operator available that can perform this conversion, or the operator cannot be cal
  led
d:\work\contextify\node_modules\nan\nan.h(683): error C2039: 'Use' : is not a member of 'node::Buffer' [d:\work\context
ify\build\contextify.vcxproj]
d:\work\contextify\node_modules\nan\nan.h(683): error C3861: 'Use': identifier not found [d:\work\contextify\build\cont
extify.vcxproj]

我已阅读Contextify Windows Install Guide,但它并没有真正帮助我。我也读过很多其他帖子。

我是否应该能够使用Visual Studio 2013进行编译?

感谢。

1 个答案:

答案 0 :(得分:1)

我有同样的问题。

我已经解决了这个问题。 节点4.x不支持Contextify。 所以我将节点降级到0.10.x,然后工作正常。

阿廖沙。