Search code examples
node.jsnpmnode-gyp

node-gyp rebuild failed while installing "weak" module on windows 7 for phantomjs


I am trying to install phantomjs-node module on a Windows 7 (64 bit) machine. There seems to be node-gyp rebuild error while installing "weak" module.

I have followed the node-gyp windows installation steps and ensured I have python installed and its path set correctly.

I have also visual c++ and other requirements needed for node-gyp. Sadly I couldn't get the node-gyp rebuild error fixed.

I have the following installed

  • node - 0.8.14(64 bit)
  • python - 2.7.3(64 bit)
  • Microsoft Visual C++ 2010 (64 bit, also installed 32bit just in case, since 64 bit didn't help)
  • Visual Studio 2010 (Pro) and Visual Studio 2012 (express, both web and desktop)
  • Windows SDK 7.1

The error I keep getting while installing the weak module is:

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.Cpp.InvalidPlatform.Targets(23,7): error MSB8007: The Platform for project 'weakref.vcxproj' is invalid. Platform='x64'. You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Platform that doesn't exist for this project.

I am stuck with the above issue, having tried all the links and had all the node-gyp requirements installed correctly. Help much appreciated.


Solution

  • After much experimenting, I was able to fix the problem.

    I reinstalled the windows sdk 7.1, this time I have changed the default path where the installation of sdk takes place. Earlier the sdk was by default getting installed to

    C:\Program Files\Microsoft SDKs\Windows\v7.1

    but after the installation was complete when I looked in C:\Program Files\Microsoft SDKs , I could not find any windows sdk, because it got installed in C:\Program Files (x86)\Microsoft SDKs\Windows folder instead. So while re-installing the windows sdk I have changed the default path which was pointing to C:\Program Files\ Microsoft SDKs to C:\Program Files (x86)\ Microsoft SDKs and that helped.

    Before re-installing windows sdk make sure to uninstall all the visual c++ versions that got installed.

    The weak module got installed but with a warning, which didn't cause any problem though. Hope this helps.