error MSB007 node.js mongoose - node.js

i'ms trying to install mongoose on mys nodeJS project and i have this error
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.Cpp.InvalidPlatform
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.Cpp.InvalidPlatform
.Targets(23,7): error MSB8007: The Platform for project 'kerberos.vcxproj' is i
.Targets(23,7): error MSB8007: The Platform for project 'bson.vcxproj' is inval
nvalid. Platform='x64'. You may be seeing this message because you are trying
id. Platform='x64'. You may be seeing this message because you are trying to b
to build a project without a solution file, and have specified a non-default Pl
uild a project without a solution file, and have specified a non-default Platfo
atform that doesn't exist for this project. [c:\testNodeMongoose\node_modules\m
rm that doesn't exist for this project. [c:\testNodeMongoose\node_modules\mongo
ongoose\node_modules\mongodb\node_modules\kerberos\build\kerberos.vcxproj]
ose\node_modules\mongodb\node_modules\bson\build\bson.vcxproj]
But i had install Python and visual studio 2010 express and Gyp. When i trying to install socket.io i have the same problem...

VS Express has no x64 build support, so you have a couple of options here:
install the trial edition of the full Visual Studio suite
uninstall 64bit node and use the x86 version
install the Windows SDK
I personally recommend the second (win32 node), since the SDK install is a pain in the back (mostly it fails with no error messages, which "may be" the sign of a "bad" vcredist version), and the full Visual Studio is not that cheap (while the trial is not a permanent solution).

32-bit Node reports warnings for bson and kerberos.
I don't understand why is node-gyp even being fired. I thought that native packages come pre-built, with binaries for my OS?
Hmm, I guess I thought wrong.
...
npm http 304 https://registry.npmjs.org/bson/0.2.2
npm http 304 https://registry.npmjs.org/kerberos/0.0.3
> kerberos#0.0.3 install D:\mbo\repos\mean-mbo\node_modules\mongodb\node_modules\kerberos
> (node-gyp rebuild 2> builderror.log) || (exit 0)
D:\mbo\repos\mean-mbo\node_modules\mongodb\node_modules\kerberos>node "C:\Program Files (x86)\nodejs
\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
> bson#0.2.2 install D:\mbo\repos\mean-mbo\node_modules\mongodb\node_modules\bson
> (node-gyp rebuild 2> builderror.log) || (exit 0)
D:\mbo\repos\mean-mbo\node_modules\mongodb\node_modules\bson>node "C:\Program Files (x86)\nodejs\nod
e_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
kerberos.cc
worker.cc
security_credentials.cc
security_buffer.cc
bson.cc
C:\Users\mbo\.node-gyp\0.10.18\deps\v8\include\v8.h(184): warning C4506: no definition for inline
function 'v8::Persistent<T> v8::Persistent<T>::New(v8::Handle<T>)' [D:\mbo\repos\mean-mbo\node_mod
ules\mongodb\node_modules\kerberos\build\kerberos.vcxproj]
with
[
T=v8::Object
]
C:\Users\mbo\.node-gyp\0.10.18\deps\v8\include\v8.h(184): warning C4506: no definition for inline
function 'v8::Persistent<T> v8::Persistent<T>::New(v8::Handle<T>)' [D:\mbo\repos\mean-mbo\node_mod
ules\mongodb\node_modules\kerberos\build\kerberos.vcxproj]
with
[
T=v8::FunctionTemplate
]
C:\Users\mbo\.node-gyp\0.10.18\deps\v8\include\v8.h(179): warning C4506: no definition for inline
function 'v8::Persistent<T> v8::Persistent<T>::New(v8::Handle<T>)' [D:\mbo\repos\mean-mbo\node_mod
ules\mongodb\node_modules\kerberos\build\kerberos.vcxproj]
with
[
T=v8::Object
]
security_buffer_descriptor.cc
security_context.cc

Make sure you have all the required software to run node-gyp:
https://github.com/TooTallNate/node-gyp
You can configure version of Visual Studio used by gyp via an environment variable so you can avoid having to set the --msvs_version=2012 property every time you do an npm install.
Examples:
set GYP_MSVS_VERSION=2012 for Visual Studio 2012
set GYP_MSVS_VERSION=2013e (the 'e' stands for 'express edition')
For the full list see
- https://github.com/joyent/node/blob/v0.10.29/tools/gyp/pylib/gyp/MSVSVersion.py#L209-294
This is still painful for Windows users of NodeJS as it assumes you have a copy of Visual Studio installed and many end users will never have this. So I'm lobbying Joyent to the encourage them to include web sockets as part of CORE node and also to possible ship a GNU gcc compiler as part of NodeJS install so we can permanently fix this problem.
Feel free to add your vote at:
https://github.com/joyent/node/issues/8005#issuecomment-50545326

Related

Node Sass No Binding for Your current environment

I've seen quite a few of these questions on SO, but none seem to solve or match the problem.
Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 6.x. The odd thing is, I don't have Node.js 6.x installed. From the command line, node -v gives me v5.10.1.
I'm the Angular4 Universal Asp.net core visual studio 2017 template straight out of the box.
I've tried
npm rebuild node-sass --force
Reordering node in Web External toolsin Visual Studio
fail: Microsoft.AspNetCore.Server.Kestrel[13]
Connection id "0HL4JSD9SSV8E": An unhandled exception was thrown by the application.
System.Exception: Call to Node module failed with error: Prerendering failed because of error: Error: Module build failed: Error: Missing binding D:\Projects\angular2\node_modules\node-sass\vendor\win32-x64-48\binding.node
Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 6.x
Found bindings for the following environments:
Windows 64-bit with Node.js 5.x
This usually happens because your environment has changed since running npm install.
Run npm rebuild node-sass --force to build the binding for your current environment.
at module.exports (D:\Projects\angular2\node_modules\node-sass\lib\binding.js:15:13)
at Object. (D:\Projects\angular2\node_modules\node-sass\lib\index.js:14:35)
Where have I gone wrong?
On Visual Studio 2017 (15.4.1) you should go to:
Tools > Configure External Tools > Projects and Solutions > Web Package Management > External Web Tools
Then reorder the tools as seen below.
This worked for me.
Deleting node_modules folder and re-installing npm modules using npm install worked for me.
Visual Studio ships it's own version of Node embedded so that's why you see a mismatch.
The TROUBLSHOOTING guide in the repo covers how to work around this https://github.com/sass/node-sass/blob/master/TROUBLESHOOTING.md#using-node-sass-with-visual-studio-2015-task-runner

Node.js on Azure Website 500 status

I am trying to get a node.js (meanjs) site running on Azure. The site work on my local environment with no errors. But after deployment when I go to my site I get a 500 error in my network tab in chrome. There are no obvious errors to me.
I used https://groups.google.com/forum/#!topic/meanjs/LrHmE43RSvA to walk me through how to set it up with the azure cli.
It is also setup to deploy form my github.
In the Azure portal the deployment dose not fail. I have read through the log and tried to find a problem but im hardly know where to start. Reading through it there are some things that look weird to me for instance. (The log is long and past the character limit or I would have posted it all.)
MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framework 2.0 SDK, 2) install Microsoft Visual Studio 2005 or 3) add the location of the component to the system path if it is installed elsewhere. [D:\home\site\repository\node_modules\bson\build\binding.sln]
and there are lots of
npm WARN unmet dependency
Then they all get processed and the files get copped to the wwwroot and finishes successfully.
Some of the things i have tried are changing the deployment branch, deleting the website and starting over. I have
Let me know if there is any thing else that I can add to this post I really want to get this working.
Thanks for any help.
Edit**
I added bson to the .gitignore and got a new error. I am also getting some new errors below is what has changed.
bson#0.2.18 install D:\home\site\repository\node_modules\bson
(node-gyp rebuild 2> builderror.log) || (exit 0)
MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framework 2.0 SDK, 2) install Microsoft Visual Studio 2005 or 3) add the location of the component to the system path if it is installed elsewhere.
[D:\home\site\repository\node_modules\bson\build\binding.sln]
npm WARN prefer global coffee-script#1.8.0 should be installed with -g
npm ERR! Error: ENOENT, chmod >'D:\home\site\repository\node_modules\flatiron\bin\flatiron'
npm ERR! If you need help, you may report this entire log,
I also added a .npmignore to the directory but it is blank. I have tried adding both the bson and flatiron to the .gitignore but that did not change the error.
From the log you posted, I can see it failed when azure tried to install an NPM module named bson during the deployment, because there's no VC++ compiler in the virtual machine your azure website located.
It worked well in your machine since you have VC++ installed.
To fix, you'd better compile this module (bson) in your machine (x86 or x64 based on which one selected in your azure website), make this module as included under node_modules folder in your .gitignore so that it will be uploaded when you commit your code.
I have a blog post mentioned this problem and I was using Node.js SQL Server Driver as an example. It also needs VC++ compile.
http://blog.shaunxu.me/archive/2012/11/16/install-npm-packages-automatically-for-node.js-on-windows-azure-web.aspx

node-gyp build error for bcrypt module in Windows_NT 6.1.7600 (x86)

I found many answers like a kind of this question, but all of them could not solve my problem. Here are my versions installed:
node 0.10.31
npm 1.4.23
node-gyp 0.10.31
bcrypt 0.7.8
I have the dependency in package.json "bcrypt": "0.7.x". Here are my step-by-step:
1) Run npm install
gyp ERR! stack Error: Can't find Python executable "python", you can
set the PYTHON env variable.
I had to install Python 2.7.*
2) Run npm install
MSBUILD : error MSB3428: Could not load the Visual C++ component
"VCBuild.exe". To fix this, 1) install the .NET Framework 2.0 SDK,
2) install Microsoft Visual Studio 2005 or 3) add the location of the
component to the system path if it is installed elsewhere.
I had to install Visual Studio 2008 (Professional) which is the only one I had in my hand. And I added the PATH variable C:\Program Files\Microsoft Visual Studio 9.0\VC\vcpackages where vcbuild.exe is.
3) Run npm install again
VCBUILD : error Message: [D:\...\node_modules\bcrypt\build\binding.sln]
VCBUILD : System error : -2147154687. [D:\...\node_modules\bcrypt\build\binding.sln]
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe`
failed with exit code: 1
It seems using .NET 4 and failed. I have six .NET frameworks folders in C:\Windows\Microsoft.NET\Framework and it seems using the latest one:
v1.0.3705
v1.1.4322
v2.0.50727
v3.0
v3.5
v4.0.30319
4) Tried npm install --msvs_version=2008
Same error as (2).
5) Tried npm install --msvs_version=2012
Error changed a little bit.
D:\...\node_modules\bcrypt\build\bcrypt_lib.vcxproj(18,3): error MSB4019: The imported
project "D:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the
<Import> declaration is correct, and that the file exists on disk.
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe`
failed with exit code: 1
6) Tried node-gyp rebuild
D:\...\node-proj>node-gyp rebuild --msvs_version=2008
'node-gyp' is not recognized as an internal or external command,
operable program or batch file.
Is there any idea on this?
I followed the Windows installation step for node-gyp and installing Microsoft Visual Studio C++ 2010 Express solved the problem except a few warnings. I did see the library created in the console message.
The build process seems looking for [Drive]:\Program Files\Microsoft Visual Studio 10.0\VC\vcpackages\vcbuild.dll which is installed by Visual Studio C++ 2010 Express.
Firstly I installed Microsoft Visual Studio C++ 2012/13 for Windows Desktop, one of the requirement for Windows7/8. But it did not work actually and it is not necessary for Windows 7.
Conclusion
The node-gyp requirement for Windows 7 32 bits (Windows 7/8 64 bits may have different requirement):
Python v2.7.3 (v3.x.x is not supported)
Windows XP/Vista/7:
Microsoft Visual Studio C++ 2010 (Express version works well)
For 64-bit builds of node and native modules you will also need the Windows 7 64-bit SDK
If the install fails, try uninstalling any C++ 2010 x64&x86 Redistributable that you have installed first.
If you get errors that the 64-bit compilers are not installed you may also need the compiler update for the Windows SDK 7.1
Windows 7/8:
Microsoft Visual Studio C++ 2012/13 for Windows Desktop (Express version works well)
This is a requirement not only for bcrypt, but all node modules which needs to be built using node-gyp. If you check the configuration files of a module, you will see its requirement, for example, you can check the following files:
\node_modules\bcrypt\build\binding.sln
\node_modules\bcrypt\build\config.gypi

Cannot install ccap (nodejs library) on windows 7

I started CMD with administrative privileges, then this: npm install -g ccap
But I get an error:
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.Cpp.InvalidPlatform
.Targets(23,7): error MSB8007: The Platform for project 'hcaptha.vcxproj' is in
valid. Platform='x64'. You may be seeing this message because you are trying t
o build a project without a solution file, and have specified a non-default Pla
tform that doesn't exist for this project. [C:\Users\adam\AppData\Roaming\npm\n
ode_modules\ccap\build\hcaptha.vcxproj]
Found a new, more likely, cause. There were some compatibility issues with gyp node and Windows x64. Check the versions of node-gyp and node and try updating. See this: https://github.com/voodootikigod/node-serialport/issues/90#issuecomment-8964116

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
> kerberos#0.0.2 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
> bson#0.1.9 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]
mongodb#1.3.9 node_modules\mongodb
├── kerberos#0.0.2
└── bson#0.1.9
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
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.
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!

Resources