从节点.js模块获取 D9025 警告和 C1083 错误...我没主意了

Getting D9025 warnings and C1083 errors from node.js modules... I'm out of ideas

本文关键字:错误 C1083 js 节点 模块 获取 警告 D9025      更新时间:2023-10-16

首先我必须清楚,我决不是javascript大师。。我对它非常热情,我喜欢学习新东西。

我运行的是带有SP1的Windows 7 Ultimate x64,Windows更新已打开,node.js版本为0.10.22。我在Visual Studio C++速成版2008、2010和2012中分别尝试过这个过程,每个.net框架都按顺序安装并进行了更新。我还试用了每个版本的最新service pack,在它们最初的干净安装之后。

所以,理论上,我应该在某个时候拥有每一种可能的组合。。。我仔细检查了环境变量,并为每个版本重新启动,只是为了更好地衡量。然而,它仍然以同样的方式失败。

我设法追踪到许多模块(node-antsails等)中的node-gyp rebuild命令,它抛出:

E:Tempnode-testnode_modulesnode-antnode_modulesusb>node "C:nodejsnode_modulesnpmbinnode-gyp-bin\....node_modulesnode-gypbinnode-gyp.js" rebuild
Build started 2013/12/06 19:46:52.
__________________________________________________
Project "E:Tempnode-testnode_modulesnode-antnode_modulesusbbuildbinding.sln" (default targets):
Target ValidateSolutionConfiguration:
    Building solution configuration "Release|x64".
Target Build:
    Target usb_bindings:
        VCBuild.exe E:Tempnode-testnode_modulesnode-antnode_modulesusbbuildusb_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:tempnode-testnode_modulesnode-antnode_modulesusbsrcnode_usb.h(5): fatal error C1083: Cannot open include file: 'string': No such file or directory
        e:tempnode-testnode_modulesnode-antnode_modulesusbsrcnode_usb.h(5): fatal error C1083: Cannot open include file: 'string': No such file or directory
        e:tempnode-testnode_modulesnode-antnode_modulesusbsrcnode_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:tempnode-testnode_modulesnode-antnode_modulesusbsrcnode_usb.h(5): fatal error C1083: Cannot open include file: 'string': No such file or directory
e:tempnode-testnode_modulesnode-antnode_modulesusbsrcnode_usb.h(5): fatal error C1083: Cannot open include file: 'string': No such file or directory
e:tempnode-testnode_modulesnode-antnode_modulesusbsrcnode_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:nodejsnode_modulesnpmnode_modulesnode-gyplibbuild.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:Tempnode-testnode_modulesnode-antnode_modulesusb
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:Tempnode-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:Tempnode-testnpm-debug.log
npm ERR! not ok code 0

我最近的一次尝试,可能是信息量最大的一次,我发现我可以指定Visual Studio构建工具来尝试与。。。

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

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

我已经尝试指定了C:nodejsnode_modulesnpmnode_modulesnode-gypgyppylibgypMSVSVersion.py文件中列出的以下每个版本,=2008=2010=2012,这些版本甚至没有达到上面列出的错误,但由于以下错误的轻微变化,失败得更快,抱怨项目版本:

E:Tempnode-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:Tempnode-testnode_modulesnode-antnode_modulesusb
> node-gyp rebuild

E:Tempnode-testnode_modulesnode-antnode_modulesusb>node "C:nodejsnode_modulesnpmbinnode-gyp-bin\....node_modulesnode-gypbinnode-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:nodejsnode_modulesnpmnode_modulesnode-gyplibbuild.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:Tempnode-testnode_modulesnode-antnode_modulesusb
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:Tempnode-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:Tempnode-testnpm-debug.log
npm ERR! not ok code 0

GitHub的repo已经沉寂了很长一段时间,所以我觉得询问可能毫无意义(不过我要搜索repo分叉,刚刚注意到有32个),但在谷歌帮助我找到的每个报告中,C1083: Cannot open include file:行的其余部分列出了它找不到的特定文件。。与我的'string'部分相反。

这是我的第一个SO问题,如果你需要更多细节,请告诉我。我每天都是Java软件测试人员,所以我对使用调试工具并不陌生。我现在真的没有主意了,有人能为我指明解决这个头痛的方向吗。。。?

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

  • 无法在Windows 7 x64/VS2012上安装需要编译的节点模块
  • https://github.com/TooTallNate/node-gyp/issues/227
  • http://wishmesh.com/2011/04/fatal-error-c1083-cannot-open-include-file-ammintrin-h-no-such-file-or-directory/
  • https://github.com/nonolith/node-usb/issues/3

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

  • https://github.com/nonolith/node-usb/issues/19

[edit2]对编辑表示歉意,但还有一点可能重要,也可能不重要。。我确实安装了CygWin,并将其包含在我的系统路径中。老实说,我在Linux上感觉更舒服,所以我很自然地在Windows的cmd提示符中使用*nix终端命令。这是否会导致一些节点模块错误地检测到Windows构建工具需要的*nix系统。。。?

找到了我的问题的解决方案,如果其他人有同样的错误,可以在这里发布作为参考。

简单的两步修复:

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

到目前为止,这已经适用于我尝试过的每一个依赖Visual Studio在安装时构建部分api的包。

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