cspada
cspada

Reputation: 75

error MSB8007 while downloading dependencies with npm and node

I am trying to install some packages in my node app with npm, and I keep getting the error below. I get the same error with socket.io and mongo. I have gone through a number of different errors similar to this, and have install so many different things as per suggestion in other threads that I really have no idea what the problem is. If anyone has any suggestion as to what I need to download/set I would greatly appreciate it.

$ npm install mongodb
npm http GET https://registry.npmjs.org/mongodb
npm http 304 https://registry.npmjs.org/mongodb
npm http GET https://registry.npmjs.org/bson/0.1.9
npm http GET https://registry.npmjs.org/kerberos
npm http 304 https://registry.npmjs.org/bson/0.1.9
npm http 304 https://registry.npmjs.org/kerberos

> [email protected] install c:\Users\Ludicritz\Desktop\Umass-running-app\node_modules\mongodb\node_modules\kerberos
> (node-gyp rebuild 2> builderror.log) || (exit 0)


c:\Users\Ludicritz\Desktop\Umass-running-app\node_modules\mongodb\node_modules\kerberos>node "c:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bi
n\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild

> [email protected] install c:\Users\Ludicritz\Desktop\Umass-running-app\node_modules\mongodb\node_modules\bson
> (node-gyp rebuild 2> builderror.log) || (exit 0)


c:\Users\Ludicritz\Desktop\Umass-running-app\node_modules\mongodb\node_modules\bson>node "c:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\.
.\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.Cpp.InvalidPlatform.Targets(23,7): error MSB8007: The Platform for project 'kerberos.vcxp
roj' is invalid.  Platform='x64'. You may be seeing this message because you are trying to build a project without a solution file, and have specifie
d a non-default Platform that doesn't exist for this project. [c:\Users\Ludicritz\Desktop\Umass-running-app\node_modules\mongodb\node_modules\kerbero
s\build\kerberos.vcxproj]
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.Cpp.InvalidPlatform.Targets(23,7): error MSB8007: The Platform for project 'bson.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. [c:\Users\Ludicritz\Desktop\Umass-running-app\node_modules\mongodb\node_modules\bson\build\
bson.vcxproj]
[email protected] node_modules\mongodb
├── [email protected]
└── [email protected]

Upvotes: 4

Views: 7346

Answers (3)

aliopi
aliopi

Reputation: 3832

While trying to install node-inspector: C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.Cpp.InvalidPlatform.Targets(23,7): error MSB8007: The Platform for project 'bufferutil.vcxproj' is invalid. Platform='x64'

My machine:

  • Win 7 64bit
  • node 0.12.7 64bit
  • Python 2.7 64bit

How I fixed it with all the advice found on the nets:

  • Uninstall all VC++ 20xx Redistributables
    • (use this MS FixIt if the uninstall fails)
  • Install Microsoft Windows SDK for Windows 7
    • Select only Visual C++ Compilers
  • Run npm install -g node-inspector --python="C:\Python27\python.exe"

If that still doesn't work try this:

  • install the MS SDK x64 Libraries
  • add this line 'AdditionalLibraryDirectories': 'C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\Lib\\x64', in every addon.gypi you find
    • C:\nodejs\node_modules\node-gyp\addon.gypi
    • C:\Users\YOU\.node-gyp\0.12.7\deps\npm\node_modules\node-gyp\addon.gypi
    • ?

addon.gypi:

... 'msvs_settings': { 'VCLinkerTool': { 'DelayLoadDLLs': [ 'iojs.exe', 'node.exe' ], # Don't print a linker warning when no imports from either .exe # are used. 'AdditionalOptions': [ '/ignore:4199' ], # THIS LINE HERE 'AdditionalLibraryDirectories': 'C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\Lib\\x64', }, ...

Good luck!

Upvotes: 0

StuBob
StuBob

Reputation: 1598

I had a simallar problem, and this is my solution. I am running windows 7 x64. I installed the x64 version of nodejs. I tried to run install and this is what I got:

At first it wanted me to put git into my path, which I did. then it wanted me to install python (not version 3.x.x but 2.x.x) and put that in my path, which I did. Then I installed visual studio 2010 (c++). after I did all of this I got this error:

D:\Source\xxxx\grunt-raptr\node_modules\node_modules\libxmljs\build\vendor\libxml\libxml.vcxproj(18,3): error MSB4019: The imported project "D:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.

I read somewhere that if you run it in the visual studio cmd you can make it work, I tried that and I got this error:

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.Cpp.InvalidPlatform.Targets(23,7): error MSB8007: The Platform for project 'libxml.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. [D:\Source\xxxx\node_modules\grunt-raptr\node_modules\libxmljs\build\vendor\libxml\libxml. vcxproj]

Once I saw this I re-installed nodejs with the x32 version and everything worked.

I hope this helps someone.

Upvotes: 3

Koray Güclü
Koray Güclü

Reputation: 2898

VS C++ Express 2010 32bit is free. if you installed 64bit edition of nodejs just remove it and install 32 bit version of the node.js

Upvotes: 10

Related Questions