从node.js模块获取D9025警告和C1083错误......我没有想法

时间:2013-12-06 18:39:42

标签: javascript c++ node.js sails.js windows-7-x64

首先我必须清楚,我绝不是一个javascript大师......我只是非常热衷于此,我喜欢学习新事物。

我正在运行带有SP1的Windows 7 Ultimate x64,Windows更新已打开,node.js为v0.10.22。我已经使用Visual Studio C ++ Express版本2008,2010和2012单独尝试了此过程,每个.net框架都按顺序安装并进行更新。我们还在最初的全新安装后尝试了每个版本的最新服务包。

所以,从理论上讲,我应该在某种程度上拥有各种可能的组合......而且我确实仔细检查了环境变量并为每个版本重新启动,这只是为了衡量标准。但它仍然以同样的方式失败。

我设法在许多模块(node-gyp rebuildnode-ant等等)中追溯到sails命令,这会抛出:

E:\Temp\node-test\node_modules\node-ant\node_modules\usb>node "C:\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild

Build started 2013/12/06 19:46:52.
__________________________________________________
Project "E:\Temp\node-test\node_modules\node-ant\node_modules\usb\build\binding.sln" (default targets):

Target ValidateSolutionConfiguration:
    Building solution configuration "Release|x64".
Target Build:
    Target usb_bindings:
        VCBuild.exe E:\Temp\node-test\node_modules\node-ant\node_modules\usb\build\usb_bindings.vcproj "Release|x64"
        cl : Command line warning D9025: overriding '/MT' with '/MD'
        cl : Command line warning D9025: overriding '/MT' with '/MD'
        cl : Command line warning D9025: overriding '/MT' with '/MD'
        cl : Command line warning D9025: overriding '/MT' with '/MD'
        e:\temp\node-test\node_modules\node-ant\node_modules\usb\src\node_usb.h(5): fatal error C1083: Cannot open include file: 'string': No such file or directory
        e:\temp\node-test\node_modules\node-ant\node_modules\usb\src\node_usb.h(5): fatal error C1083: Cannot open include file: 'string': No such file or directory
        e:\temp\node-test\node_modules\node-ant\node_modules\usb\src\node_usb.h(5): fatal error C1083: Cannot open include file: 'string': No such file or directory
        Project : warning PRJ0018: The following environment variables were not
found:
    Done building target "usb_bindings" in project "binding.sln" -- FAILED.
Done building target "Build" in project "binding.sln" -- FAILED.

Done building project "binding.sln" -- FAILED.

Build FAILED.
cl : Command line warning D9025: overriding '/MT' with '/MD'
cl : Command line warning D9025: overriding '/MT' with '/MD'
cl : Command line warning D9025: overriding '/MT' with '/MD'
cl : Command line warning D9025: overriding '/MT' with '/MD'
Project : warning PRJ0018: The following environment variables were not found:
e:\temp\node-test\node_modules\node-ant\node_modules\usb\src\node_usb.h(5): fatal error C1083: Cannot open include file: 'string': No such file or directory
e:\temp\node-test\node_modules\node-ant\node_modules\usb\src\node_usb.h(5): fatal error C1083: Cannot open include file: 'string': No such file or directory
e:\temp\node-test\node_modules\node-ant\node_modules\usb\src\node_usb.h(5): fatal error C1083: Cannot open include file: 'string': No such file or directory
    5 Warning(s)
    3 Error(s)

Time Elapsed 00:00:00.17
gyp ERR! build error
gyp ERR! stack Error: `msbuild` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd E:\Temp\node-test\node_modules\node-ant\node_modules\usb
gyp ERR! node -v v0.10.22
gyp ERR! node-gyp -v v0.11.0
gyp ERR! not ok
npm ERR! usb@0.2.3 preinstall: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the usb@0.2.3 preinstall script.
npm ERR! This is most likely a problem with the usb package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls usb
npm ERR! There is likely additional logging output above.

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\nodejs\\\\node.exe" "C:\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "node-ant" "--msvs_version=auto"
npm ERR! cwd E:\Temp\node-test
npm ERR! node -v v0.10.22
npm ERR! npm -v 1.3.14
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     E:\Temp\node-test\npm-debug.log
npm ERR! not ok code 0

我最新且可能提供最多信息的尝试,我发现我可以指定Visual Studio构建工具来尝试使用...

E:\Temp\node-test>npm install node-ant --msvs_version=auto

...似乎=auto试图从环境变量(?)中检测版本。

我已尝试指定C:\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\MSVSVersion.py文件中列出的以下每个版本,=2008=2010=2012,这些版本甚至没有得到上面列出的错误,即使在下面的错误略有变化的情况下也会失败,抱怨项目版本:

E:\Temp\node-test>npm install node-ant --msvs_version=2008
npm http GET https://registry.npmjs.org/node-ant
npm http 304 https://registry.npmjs.org/node-ant
npm http GET https://registry.npmjs.org/usb
npm http 304 https://registry.npmjs.org/usb

> usb@0.2.3 preinstall E:\Temp\node-test\node_modules\node-ant\node_modules\usb
> node-gyp rebuild


E:\Temp\node-test\node_modules\node-ant\node_modules\usb>node "C:\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild

build/binding.sln(1): Solution file error MSB5014: File format version is not recognized.  MSBuild can only read solution files between versions 7.0 and 9.0, in
clusive.
gyp ERR! build error
gyp ERR! stack Error: `msbuild` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd E:\Temp\node-test\node_modules\node-ant\node_modules\usb
gyp ERR! node -v v0.10.22
gyp ERR! node-gyp -v v0.11.0
gyp ERR! not ok
npm ERR! usb@0.2.3 preinstall: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the usb@0.2.3 preinstall script.
npm ERR! This is most likely a problem with the usb package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls usb
npm ERR! There is likely additional logging output above.

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\nodejs\\\\node.exe" "C:\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "node-ant" "--msvs_version=2008"
npm ERR! cwd E:\Temp\node-test
npm ERR! node -v v0.10.22
npm ERR! npm -v 1.3.14
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     E:\Temp\node-test\npm-debug.log
npm ERR! not ok code 0

GitHub repo已经安静了很长时间,所以我想要问可能没有意义(我会搜索回购分叉,只是注意到有32个),但在每个报告中Google帮助我查找C1083: Cannot open include file:行,其余行列出了无法找到的特定文件。与我的'string'部分相对。

这是我的第一个问题,如果您需要更多详细信息,请与我们联系。我白天是一名Java软件测试人员,所以我对使用调试工具并不陌生。我现在真的没有想法了,任何人都能指出我解决这个问题的方法......?

[编辑]作为参考,以下是我发现的一些类似问题,每个问题都尽可能地尝试了。

官方回购发行清单中最相似(未答复)的一个。

[edit2]为编辑道歉,但另外一点可能重要也可能不重要..我确实安装了CygWin,并包含在我的系统路径中。老实说我觉得在Linux上更舒服,所以我自然会在Windows cmd提示符下使用* nix终端命令。这是否会导致某些节点模块错误地检测* nix系统以获取Windows构建工具所需的内容......?

1 个答案:

答案 0 :(得分:1)

找到我的问题的解决方案,如果其他人有这些相同的错误,请在此处发布作为参考答案。

简单的两步修复:

  • 通过Visual Studio Developer命令提示符运行所有命令,我使用了VS2012。
  • 安装node-gyp作为全局模块:npm install -g node-gyp
  • 在安装时指定VS版本:npm install sails --msvs_version=2012

到目前为止,这已经适用于我尝试过的所有依赖Visual Studio在安装时构建它的api的软件包。

我相信这也适用于VS2010;在这种情况下,请指定适当的--msvs_version