First I must be clear, I am by no means a javascript guru.. I'm simply very enthusiastic about it and I enjoy learning new things.
I'm running Windows 7 Ultimate x64 with SP1, Windows updates are on, node.js is v0.10.22. I've tried this process individually with Visual Studio C++ Express versions 2008, 2010 and 2012, each .net framework is installed in order with updates. I also tried each version's latest service pack after their initial clean installs.
So, in theory I should at some point have had each possible combination... And I did double check environment variables and reboot for each version, just for good measure. Yet it still fails the same way.
I'm managed to track this back as far as the node-gyp rebuild
command in numerous modules (node-ant
, sails
, etc..), which throws out:
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
My latest and possible most informative attempt, I discovered I could specify the Visual Studio build tools to try use with...
E:\Temp\node-test>npm install node-ant --msvs_version=auto
...of which it seems =auto
tries to detect the version from the environment variables(?).
I've tried specifying each of the following versions I found listed in the C:\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\MSVSVersion.py
file, =2008
, =2010
and =2012
, the ones that don't even get as far as the error listed above, fail even sooner with slight variations of the following error, complaining about project versions:
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
The GitHub repo has been quiet for a really long time so I figure asking there may be pointless (I'm going to search the repo forks though, just noticed there are 32 of them), but in each report Google helps me find for the C1083: Cannot open include file:
line, the rest of the line lists a specific file it can't find.. As opposed to my 'string'
section.
This is my first SO question, so let me know if you need more details. I'm a Java software tester by day so I'm no stranger to using debug tools. I'm truly out of ideas here now, anyone able to point me in the direction of a solution for this headache...?
[edit] For reference, here are a few of the similar issues I've found, each of which I've tried the suggestions made as closely as possible.
- Cannot install node modules that require compilation on 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
And the most similar (unanswered) one in the official repo issues list.
[edit2] Apologies for the edits, but one other point that may or may not be important.. I do have CygWin installed, and included in my system path. Honestly I feel more comfortable on Linux, so I naturally use *nix terminal commands inside Windows' cmd
prompt. Could this be causing some node modules to incorrectly detect a *nix system for something the Windows build tools need...?