V
V
vasIvas2015-03-13 15:58:34
MongoDB
vasIvas, 2015-03-13 15:58:34

How to fix error when starting mongose.js?

Installed mongodb ran config. Installed mongose. wrote two lines from the help

var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/test');

And after executing this file in node I get an error -
{ [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }
js-bson: Failed to load c++ bson extension, using pure JS version

I googled the error and found something similar to Stack Overflow, but there the answer is given for mac and ubuntu,
but I don’t understand how to pull it on windows. And in questions everywhere there is also an
error, but I don’t have it. Therefore, without advice, it’s scary to rebuild everything and then put it up, don’t understand what.
UPD:
Version 1.2.0 ( iojs ).
Installing bson both locally and globally did not help.
And I also noticed that when installing bson and mongose, a strange line appears with rebuild .
C:\Users\Ivan\AppData\Roaming\npm\node_modules\bson>node "C:\Program Files\iojs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node- gyp\bin\node-gyp.js" rebuild

UPD:2
Removed iojs installed nodejs. When reinstalling mongoose, the same problem appeared with gyp
F:\projects\projects\test\node_modules\mongoose\node_modules\mongodb\node_modules\kerberos>node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\ node_modules\node-gyp\bin\node-gyp.js" rebuild

But there's also this -
Build projects in this solution one at a time. To enable parallel build, add the "/m" option.

And here it is -
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 20
05 or 3) add the location of the component to the system path if it is installed elsewhere. [F:\projects\test\node_modules\mongoose\node_modules\mongod
b\node_modules\kerberos\build\binding.sln]

UPD:3
D:\projects\projects\closure-test>npm install --save mongoose
npm WARN package.json [email protected] No repository field.
|
> [email protected] install D:\projects\projects\closure-test\node_modules\mongoose
\node_modules\mongodb\node_modules\kerberos
> (node-gyp rebuild 2> builderror.log) || (exit 0) C:\Program Files\
nodejs
\node_modules\npm\bin\node-gyp-b
in \\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
Build the projects in this solution one at a time. To enable parallel build, add
the "/m" option.
kerberos.cc
worker.
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xlocale(337):
warning C4530: C++ exception handler used, but unwind semantics are not enabled.
Specify /EHsc (..\lib\win32\wrappers\security_buffer.cc) [D:\projects\projects\
closure-test\node_modules\mongoose\node_modules\mongodb\node_modules\kerberos\b
uild\kerberos.vcxproj]
security_buffer_descriptor. cc
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xlocale(337):
warning C4530: C++ exception handler used, but unwind semantics are not enabled.
Specify /EHsc (..\lib\win32\wrappers\security_buffer_descriptor.cc) [D:\project
s\projects\closure-test\node_modules\mongoose\node_modules\mongodb\node_modules
\kerberos\build\kerberos.vcxproj]
security_context.cc
security_credentials.cc
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xlocale(337):
warning C4530: C++ exception handler used, but unwind semantics are not enabled.
Specify /EHsc (..\lib\win32\wrappers\security_credentials.cc) [D:\projects\proj
ects\closure-test\node_modules\mongoose\node_modules\mongodb\node_modules\kerbe
ros\build\kerberos.vcxproj]
C :\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xlocale(337):
warning C4530: C++ exception handler used, but unwind semantics are not enabled.
Specify /EHsc (..\lib\win32\wrappers\security_context.cc) [D:\projects\projects
\closure-test\node_modules\mongoose\node_modules\mongodb\node_modules\kerberos\
build\kerberos.vcxproj]
base64.c
kerberos_sspi.c
Creating library D:\projects\projects\closure-test\node_modules\mongoose\n
ode_modules\mongodb \node_modules\kerberos\build\Release\kerberos.lib and obje
ct D:\projects\projects\closure-test\node_modules\mongoose\node_modules\mongo
db\node_modules\kerberos\build\Release\kerberos.exp
Generating code
Finished generating code
kerberos.vcxproj -> D:\projects\projects\closure-test\node_modules\mongoose\n
ode_modules\mongodb\node_modules\kerberos\build\Release\\kerberos.node
[email protected] node_modules\mongoose
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
└── [email protected] ([email protected], [email protected])

Answer the question

In order to leave comments, you need to log in

4 answer(s)
Y
Yuri Shikanov, 2015-03-13
@dizballanze

Apparently it can't find the bson module .
Try installing it separately manually: npm install bson
And by the way, what version of node.js/npm are you using?

A
Alexander Tartmin, 2015-03-14
@baskerville42

Under windows, some things do not work well, believe me - I myself sin like this
. With a node, I can only advise you to read the instructions for installing node-gyp under these windows of yours =)

S
Sveratum, 2015-03-16
@srsd

The same error but already on Centos 6.5. Node.js-12 and npm 2.7.1.
Maybe someone knows how to fix it?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question