Looks like you’re having trouble with the “Cannot find module ‘mongoose’” error in NodeJS. To get around this issue, you need to install the mongoose package before using it. Check out the information below for the solution.
Why does this error occur in your project?
The leading cause of this error is most likely because you have not installed the package ‘mongoose’ in your project.
Mongoose is a JavaScript framework commonly used in Node.js applications with the database as MongoDB. However, it is not built-in when you initialize a NodeJS project. That’s why you need to install the mongoose package before using it to avoid getting the error message “Cannot find module ‘mongoose’”.
Solved – “Cannot find module ‘mongoose’” error in NodeJS
You must install the mongoose package to get around this error in NodeJS. To do this, open the terminal at the root of your project and execute the command below:
::install the mongoose package
npm install mongoose
::if you want to install the latest version
npm install [email protected]
After executing the above command, ‘mongoose’ will be added to your project’s dependencies.
Open the package.json file and check. You should now see the dependencies object containing ‘mongoose’ as shown below:
{ "dependencies": { "mongoose": "^6.8.0", //...other settings } //...other settings }
If your package.json file does not contain the ‘mongoose’ package like in the example above, your installation has failed.
Now you can manually fill in the object dependencies with the line: ‘mongoose’: #version (replace #version with the version you want to install), then run this command:
npm install
After the installation, we recommend you restart the IDE to ensure your project is up to date with the latest changes.
If the error persists, try removing the ‘node_modules’ folder and ‘package_lock.json’ file in your project, then execute the ‘npm-install’ command again:
rm -rf node_modules
rm -f package-lock.json
npm install
At this point, the error seems to have been solved. You can already start working with the ‘mongoose’ package in your project without worrying about the error.:
// Import if you get error when use `require()` syntax import { createRequire } from 'module'; const require = createRequire(import.meta.url); // Use the Node.js `require()` const mongoose = require('mongoose'); console.log(mongoose.version);
or
// Use the ES6 imports import mongoose from 'mongoose'; console.log(mongoose.version);
Conclusion
To sum up, we just shared with you the solution for the “Cannot find module ‘mongoose’” error in Node.js. You must install the ‘mongoose’ package before using it to get rid of this problem. That’s the end of this post. Hopefully, the information we provide will be helpful to you.
Maybe you are interested:
- Cannot find module ‘cors’ error in Node.js
- Cannot find module ‘bcrypt’ in Node.js
- Cannot find module ‘#’ error in node.js
My name’s Christopher Gonzalez. I graduated from HUST two years ago, and my major is IT. So I’m here to assist you in learning programming languages. If you have any questions about Python, JavaScript, TypeScript, Node.js, React.js, let’s contact me. I will back you up.
Name of the university: HUST
Major: IT
Programming Languages: Python, JavaScript, TypeScript, Node.js, React.js
Содержание
- Error cannot find module mongoose
- Cannot find module ‘mongoose’ error in Node.js #
- Delete your node_modules and reinstall your dependencies #
- Verify mongoose is contained in your dependencies object #
- Conclusion #
- How to resolve “Cannot find module ‘mongoose’” error in Node.js
- Why does this error occur in your project?
- Solved – “Cannot find module ‘mongoose’” error in NodeJS
- Error cannot find module mongoose please help #663
- Comments
- Footer
- Как исправить ошибку при запуске mongose.js?
- after the latest update I can’t get mongoose to work neither on windows 8 or on the server #2906
- Comments
Error cannot find module mongoose
Reading time В· 2 min
Cannot find module ‘mongoose’ error in Node.js #
To solve the error «Cannot find module ‘mongoose’», make sure to install the mongoose package by opening your terminal in your project’s root directory and running the following command: npm i mongoose and restart your IDE and development server.
Open your terminal in your project’s root directory (where your package.json file is located) and run the following command:
This will add the mongoose package to the dependencies of your project.
Delete your node_modules and reinstall your dependencies #
If the error is not resolved, try to delete your node_modules and package-lock.json (not package.json ) files, re-run npm install and restart your IDE.
Verify mongoose is contained in your dependencies object #
If you still get the «Cannot find module ‘mongoose’» error, open your package.json file and make sure it contains the mongoose package in the dependencies object.
You can try to manually add the line and re-run npm install .
Or install the latest version of the package:
The mongoose module should NOT be globally installed or be in your project’s devDependencies , it should be in the dependencies object in your package.json file.
Conclusion #
To solve the error «Cannot find module ‘mongoose’», make sure to install the mongoose package by opening your terminal in your project’s root directory and running the following command: npm i mongoose and restart your IDE and development server.
Источник
How to resolve “Cannot find module ‘mongoose’” error in Node.js
Looks like you’re having trouble with the “Cannot find module ‘mongoose’” error in NodeJS. To get around this issue, you need to install the mongoose package before using it. Check out the information below for the solution.
Table of Contents
Why does this error occur in your project?
The leading cause of this error is most likely because you have not installed the package ‘mongoose’ in your project.
Mongoose is a JavaScript framework commonly used in Node.js applications with the database as MongoDB. However, it is not built-in when you initialize a NodeJS project. That’s why you need to install the mongoose package before using it to avoid getting the error message “Cannot find module ‘mongoose’”.
Solved – “Cannot find module ‘mongoose’” error in NodeJS
You must install the mongoose package to get around this error in NodeJS. To do this, open the terminal at the root of your project and execute the command below:
After executing the above command, ‘mongoose’ will be added to your project’s dependencies.
Open the package.json file and check. You should now see the dependencies object containing ‘mongoose’ as shown below:
If your package.json file does not contain the ‘mongoose’ package like in the example above, your installation has failed.
Now you can manually fill in the object dependencies with the line: ‘mongoose’: #version (replace #version with the version you want to install), then run this command:
After the installation, we recommend you restart the IDE to ensure your project is up to date with the latest changes.
If the error persists, try removing the ‘node_modules’ folder and ‘package_lock.json’ file in your project, then execute the ‘npm-install’ command again:
At this point, the error seems to have been solved. You can already start working with the ‘mongoose’ package in your project without worrying about the error.:
Источник
Error cannot find module mongoose please help #663
C:UsersNickDesktopturntablefmBotsSuper Bot>node bot.js
node.js:201
throw e; // process.nextTick error, or ‘error’ event on first tick
^
Error: Cannot find module ‘mongoose’
at Function._resolveFilename (module.js:334:11)
at Function._load (module.js:279:25)
at Module.require (module.js:357:17)
at require (module.js:368:17)
at Object. (C:UsersNickDesktopturntablefmBotsSuper Botdb.j
s:1:78)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
at Module.require (module.js:357:17)
i just used npm install mongoose it all worked fine but i get this error when using node any ideas thanks in advance
The text was updated successfully, but these errors were encountered:
is mongoose in your node_modules directory? hard to say without more detail.
closing. no reply
The same problem here,
yes it is in node_modules directory
@lalehsbr This is probably an issue with your environment, can you join us in one of these communities so that we can help you out in real time:
© 2023 GitHub, Inc.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Источник
Как исправить ошибку при запуске mongose.js?
Установил mongodb запустил конфиг. Установил mongose. написал две строчки из хелпа
И выполнив этот файл в node получаю ошибку —
Гуглил ошибку и нашел похожее на Stack Overflow, но там ответ дан для mac и ubuntu,
но как его натянуть на windows я не понимаю. И в вопросах везде присутствует ещё
error, а у меня её нет. По этому без совета страшно все сновить а потом ставить не пойми что.
UPD:
Версия 1.2.0 ( iojs ).
Установка bson как локально так и глобально не помогла.
И ещё я заметил что при установке bson и mongose появляется странная строка с rebuild.
C:UsersIvanAppDataRoamingnpmnode_modulesbson>node «C:Program Filesiojsnode_modulesnpmbinnode-gyp-bin\….node_modulesnode-gypbinnode-gyp.js» rebuild
UPD:2
Удалил iojs поставил nodejs. При переустановки mongoose появилась та же проблема с gyp
F:projectsprojectstestnode_modulesmongoosenode_modulesmongodbnode_moduleskerberos>node «C:Program Filesnodejsnode_modulesnpmbinnode-gyp-bin\….node_modulesnode-gypbinnode-gyp.js» rebuild
Построение проектов в этом решении по одному. Чтобы включить параллельную сборку, добавьте параметр «/m».
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:projectstestnode_modulesmongoosenode_modulesmongod
Источник
after the latest update I can’t get mongoose to work neither on windows 8 or on the server #2906
The text was updated successfully, but these errors were encountered:
That’s strange. Try doing an npm cache clear and a clean npm install rm -rf node_modules && npm install . What version of mongoose is this happening with?
I went back to 4.0.1 and now it works
Are there any errors when you do npm install ?
I am getting a different error, but also only on 4.0.2.
Reverting to 4.0.1 resolves the issue.
@brandom please provide code that reproduces this error.
@vkarpov15 I’ve been working on it. My app is rather large with a lot of bootstrap happening with the models. This happens somewhere in the bootstrap so I am only adding plugins and instantiating the models.
That would be great. Stack traces are better than nothing but they’re of limited use because they don’t really provide any context.
I’m receiving the same error that @brandom has received. Mongoose v3.8.24. Node.js v6.7.0.
Unfortunately I can’t upgrade my Mongoose version due to compatibility issues. Is there any workaround for it?
@williamknn IIRC this was very specific to 4.0.2 for me. Looks like #2908 gets to the heart of the issue and the fix was in cb975db. Perhaps simply adding the appropriate bson version as a direct dependency of your project would fix it? Can’t remember enough about module resolution in node v6 at this time to say for sure, but it’s worth a quick experiment.
@brandom Thanks for your suggestion, but I’ve found the problem already. The crash has occurred after I made a merge with two branches. I looked up into the code and found the query that someone’s have wrote and it’s not supported in our Mongoose version.
This is the query:
Users.find( < «userInfo.subscriptions»: < $exists: true, $not: < $size: 0 >> >, < «userInfo»: 1 >)
I haven’t found the $not operator in Mongoose 3.8.x docs, so I think this was the problem. When I deleted the query, everything started to work again.
@williamknn that’s strange, I can’t think of a reason why that query wouldn’t work in mongoose 5. Can you show your schemas please?
@vkarpov15 I’ve deleted some data because the schema is too long, and my Mongoose version is the 3.8.24:
https://pastebin.com/Fp93tDdh
What’s preventing you from upgrading? 3.8.24 is 3 years old.
Too many deprecated functions. I’ve tried already but when I saw that is a job for a whole day (being VERY optimistic) I’ve gave up. Our application was constructed over MEAN.js v0.3.3 (from July of 2015) and there are a lot of things that may need to upgrade too when grow the Mongoose version.
I’m scheduling a week to update all the stuff we need to upgrade but for now, I’ve too many things on my backlog :/
That’s reasonable, we’ll investigate and see if we can find what’s causing this issue
@williamknn looks like the pastebin is gone?
Источник
λ ~/Public/MyProject/ staging* node-gyp rebuild ∞
gyp info it worked if it ends with ok
gyp info using node-gyp@3.4.0
gyp info using node@5.10.1 | darwin | x64
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp info spawn /usr/bin/python
gyp info spawn args [ '/Users/nexus/.nvm/versions/node/v5.10.1/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/Users/nexus/Public/MyProject/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/nexus/.nvm/versions/node/v5.10.1/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/nexus/.node-gyp/5.10.1/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/Users/nexus/.node-gyp/5.10.1',
gyp info spawn args '-Dnode_gyp_dir=/Users/nexus/.nvm/versions/node/v5.10.1/lib/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=node.lib',
gyp info spawn args '-Dmodule_root_dir=/Users/nexus/Public/MyProject',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.' ]
gyp: binding.gyp not found (cwd: /Users/nexus/Public/MyProject) while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/Users/nexus/.nvm/versions/node/v5.10.1/lib/node_modules/node-gyp/lib/configure.js:305:16)
gyp ERR! stack at emitTwo (events.js:100:13)
gyp ERR! stack at ChildProcess.emit (events.js:185:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
gyp ERR! System Darwin 15.5.0
gyp ERR! command "/Users/nexus/.nvm/versions/node/v5.10.1/bin/node" "/Users/nexus/.nvm/versions/node/v5.10.1/bin/node-gyp" "rebuild"
gyp ERR! cwd /Users/nexus/Public/MyProject
gyp ERR! node -v v5.10.1
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
When you enter the command NPM start
to start the project, sometimes you will encounter such Error Error: Cannot find module ‘mongoose’, missing the module mongoose
.
Error: Cannot find module 'mongoose'
at Function.Module._resolveFilename (module.js:536:15)
at Function.Module._load (module.js:466:25)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (D:loginprojectroutesindex.js:3:16)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node ./bin/www`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:Program Filesnodejsnode_cache_logs2019-01-09T01_53_44_235Z-debug.log
The solution at this point is to install the missing module:
npm install mongoose
Run successfully, open the browser to enter the access address, you can see the project.
Girl when she was the original author: qi technology blog: https://www.jianshu.com/u/05f416aefbe1
90 front after sister, love programming, love, love.
stick to summarize the technical problems encountered in the work, keep a record of what you think and see in the work, for the blog above there are no questions, you can join the qq group to ask me: 473819131.
Read More:
score:-1
on windows if you do
npm install mongoose
it will install it by default on your C: Drive
and if you try to run some *.js file from say D: drive
it will give you same error.
so i guess the installation directory and the *.js file should have same root.
score:0
in the directory housing bot.js, is there a node_modules folder that has a mongoose folder in it? Is your mongodb server running?
You can test it also by being in the project’s root directory, calling node (no args, to open the REPL), and trying to require mongoose there.
Similar Question and Answer
- Error when running node script , Cannot find module ‘mongodb/node_modules/bson’
- Node.js error Error: Cannot find module ‘mongoose’
- Mongoose: Error cannot find module debug
- Error: Cannot find module ‘./drivers’ with mongoose only on the server
- Heroku Deploy Error: Cannot get Node App running after Deploy : Cannot find module ‘/app/web.js’
- How to fix Error cannot find module ‘core-js/es6’
- Cannot find module ‘./collection/batch/unordered’ — Node JS on Heroku
- Cannot find module mongoose
score:0
You are using windows operation system which mongoose doesn’t support. It is apparent from this error message:
C:>npm install mongoose
npm http GET https://registry.npmjs.org/mongoose/2.5.10
npm http 304 https://registry.npmjs.org/mongoose/2.5.10
npm http GET https://registry.npmjs.org/hooks/0.2.0
npm http GET https://registry.npmjs.org/mongodb/0.9.9-4
npm http 304 https://registry.npmjs.org/mongodb/0.9.9-4
npm http 304 https://registry.npmjs.org/hooks/0.2.0
npm WARN package.json mongodb@0.9.9-4 No README.md file found!
npm ERR! notsup Unsupported
npm ERR! notsup Not compatible with your operating system or architecture: mongo
db@0.9.9-4
npm ERR! notsup Valid OS: linux,darwin,freebsd
npm ERR! notsup Valid Arch: any
npm ERR! notsup Actual OS: win32
npm ERR! notsup Actual Arch: x64
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nod
ejs\node_modules\npm\bin\npm-cli.js" "install" "mongoose"
npm ERR! cwd C:
npm ERR! node -v v0.8.18
npm ERR! npm -v 1.2.2
npm ERR! code EBADPLATFORM
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:npm-debug.log
npm ERR! not ok code 0
score:0
From the doc/blog
In general, the rule of thumb is:
If you’re installing something that you want to use in your program,
using require(‘whatever’), then install it locally, at the root of
your project.If you’re installing something that you want to use in
your shell, on the command line or something, install it globally, so
that its binaries end up in your PATH environment variable.
Related questions and answers
- Error: Cannot find module ‘../models/User’ — Mongoose schema
- Error with mongodb driver on Heroku: Cannot find module ‘mongodb-core’
- Error: Cannot find module running node js and express.js app
- module.js:549 throw err; Error: Cannot find module ‘./models/TodoListModel’ Nodemon shows this error on adding model file
- UnhandledPromiseRejectionWarning: Error: Cannot find module ‘tailwindcss’ heroku error
- Heroku cannot find mongoose module after deployment?
- ERR_MODULE_NOT_FOUND: Cannot find Module Error
- I got following error while developing in MEAN stack : Cannot find module ‘mongojs’
- Mongoose is installed, but I get the error «Cannot Find Module Mongoose»
- Node.js NPM config error — » Error: Cannot find module ‘./config/mail’ «
- Cannot find module ‘../build/Release/bson’] code: ‘MODULE_NOT_FOUND’ } js-bson: Failed to load c++ bson extension, using pure JS version
- node.js cannot find module ‘mongodb’
- Cannot find module in Nodejs
- Node.js and mongoose (mongodb) error cannot read property » of null
- Node mongoose find query in loop not working
score:0
Just open your project folder in command line and run below command so that mongoose dependency can be added in package.json file. I am 100% sure you will not get such error again.
$ sudo npm install —save mongoose
score:0
For Typescript, I had to add @types/mongoose: yarn add -D @types/mongoose
score:0
npm install mongoose —save //it will add file in package.json
—if still not solved close you cmd and editor and open again
score:0
if you are using Yarn:
yarn add mongoose
score:1
npm install creates «node_modules» in the pwd(present working directory)
as your application grows, the number of required modules grow and the better approach is to maintain a package.json (reference: https://stackoverflow.com/a/14226133/832147 ) and then issue just «npm install» instead of installing each.
As an extension when deploying your app on platforms like Heroku, you can ignore (git ignore) your huge node_modules directory of your project. Heroku installs your dependent modules by reading your package.json
this approach makes us create the same required node modules for each of our node based projects but it is okay as we need to issue the «npm install» command only once per project
score:1
If you already installed mongoose globally (npm install -g mongoose), then do
% npm link mongoose
in the project directory. This worked for me.
score:1
I had the same problem. But I just used mongose
instead of mongoose
.
The packages names are almost similar.
score:2
I got the same problem in my Mac and did a search in spotlight and found that mongoose is installed in /usr/local/node_modules (when I ran ‘npm install mongoose’). Moving the mongoose folder to ~(home) node_modules where npm is supposted to actually install fixed my issue.
score:5
npm install mongoose
it will work and if everything is alright then you will get following in your terminal
mongoose@4.4.19 node_modules/mongoose
├── sliced@1.0.1
├── hooks-fixed@1.1.0
├── regexp-clone@0.0.1
├── mpromise@0.5.5
├── muri@1.1.0
├── kareem@1.0.1
├── mpath@0.2.1
├── bson@0.4.23
├── mquery@1.10.0 (sliced@0.0.5, debug@2.2.0, bluebird@2.10.2)
└── mongodb@2.1.18 (readable-stream@1.0.31, es6-promise@3.0.2, mongodb-core@1.3.18)
score:6
You have to call in the command line
npm install mongoose
remember to call this command from the root path of your project
score:9
Install with the --save
option:
npm install mongoose --save
This adds mongoose it to package.json
which Heroku uses to build your app.
score:19
You can do either of two things to make it run :-
1) Install mongoose globally with below steps :-
a)npm install mongoose -g
b) Go to your app directory, where bot.js is located and then run
npm link mongoose
Explanation :- When you install a package globally via npm, it is downloaded to global node_module folder. For me(Mac user), it’s under /usr/local/lib/node_modules/mongoose. We link this to that directory from where you are trying to run module.js.
2) Another approach is to install mongoose locally, not globally via
npm install mongoose
After following either of these, you will be seeing node_modules —> mongoose folder under the ‘bot.js’ directory, which means mongoose has been successfully installed.
Now, run node bot.js , it will work .
score:52
try installing mongoose using this command:
npm install mongoose
do not use the -g switch.
BTW: I ran command prompt in admin mode. Reference
More questions
- Cannot find module ‘mongodb-client-encryption’
- Error: Cannot find module ‘@heroku/buildpack-registry’
- Cannot save a document in Mongoose — Validator required failed for path error
- Error: Cannot find module ‘../build/Release/bson’ on Mac
- MongoDB — Error: Cannot find module ‘../build/Release/bson’
- Find all documents in one collection, change data and save into another collection using mongoose and node express
- MongoDB error not master and slaveOk=false on primary node with mongoose
More questions with similar tag
- Assign property value doesn’t work in Mongoose
- MongoDB update field with another field from another collection
- SailsJS blueprint GET model with no limit
- combine geoNear query with another query for a value
- mongodb — mapReduce() scope — Undefined values are converted into null values
- MongoDB — Update One Field or Another
- this is the warning , how to solve this?
- PHP/MongoDB — Add subdocument to document with _id
- Setting up Login with Mongodb and nodejs
- Mongoose query in array for retrieving elements starting from index 0 to n where n is the position of the element from the last
- mongodb: how to do backup of mongodb
- MongDB Atlas document size increased 16MB, update/delete option possibility?
- Meteor Mongo Collections find forEach cursor iteration and saving to ElasticSearch Problem
- Aggregate Count Array Members Matching Condition
- How do I write a query in MongoDB that gives me all documents that contain all specified nested documents?
- Dynamic routes in express, «Cannot read property ‘concat’ of undefined» error
- Filter Search query in Spring Mongo DB
- Mongo query to find top value for some unique keys
- MongoDB | How to find who updated a given document/record?
- New mongoose boolean attribute, everyone at true, default is false
- How to pass an ObjectId into a POST request?
- Which mongoose query fails using async await
- Querying ReferenceFields with MongoEngine
- MongoDB: Is it possible to limit the results of $lookup to certain fields (as a projection)?
- About mongodb 3.0.2 auth
- Can I use MongoDB as a replacement for CoreData on iOS?
- Select nested property from MongoDB repository with Spring Boot
- Abstracting MongoDb Connection try, catch, finally with a callback
- Aggregate and unwind array, but keep top level key
- Convert ObjectID to String in Springboot mongo Aggregation
Установил mongodb запустил конфиг. Установил mongose. написал две строчки из хелпа
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/test');
И выполнив этот файл в node получаю ошибку —
{ [Error: Cannot find module ‘../build/Release/bson’] code: ‘MODULE_NOT_FOUND’ }
js-bson: Failed to load c++ bson extension, using pure JS version
Гуглил ошибку и нашел похожее на Stack Overflow, но там ответ дан для mac и ubuntu,
но как его натянуть на windows я не понимаю. И в вопросах везде присутствует ещё
error, а у меня её нет. По этому без совета страшно все сновить а потом ставить не пойми что.
UPD:
Версия 1.2.0 ( iojs ).
Установка bson как локально так и глобально не помогла.
И ещё я заметил что при установке bson и mongose появляется странная строка с rebuild.
C:UsersIvanAppDataRoamingnpmnode_modulesbson>node «C:Program Filesiojsnode_modulesnpmbinnode-gyp-bin\….node_modulesnode-gypbinnode-gyp.js» rebuild
UPD:2
Удалил iojs поставил nodejs. При переустановки mongoose появилась та же проблема с gyp
F:projectsprojectstestnode_modulesmongoosenode_modulesmongodbnode_moduleskerberos>node «C:Program Filesnodejsnode_modulesnpmbinnode-gyp-bin\….node_modulesnode-gypbinnode-gyp.js» rebuild
Но ещё прибавилось вот это —
Построение проектов в этом решении по одному. Чтобы включить параллельную сборку, добавьте параметр «/m».
И вот это —
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:projectstestnode_modulesmongoosenode_modulesmongod
bnode_moduleskerberosbuildbinding.sln]
UPD:3
D:projectsprojectsclosure-test>npm install —save mongoose
npm WARN package.json samp-headhunters@0.0.1 No repository field.
|
> kerberos@0.0.9 install D:projectsprojectsclosure-testnode_modulesmongoose
node_modulesmongodbnode_moduleskerberos
> (node-gyp rebuild 2> builderror.log) || (exit 0)D:projectsprojectsclosure-testnode_modulesmongoosenode_modulesmongodbnod
e_moduleskerberos>node «C:Program Filesnodejsnode_modulesnpmbinnode-gyp-b
in\….node_modulesnode-gypbinnode-gyp.js» rebuild
Сборка проектов в этом решении по одному. Чтобы включить параллельную сборку, до
бавьте параметр «/m».
kerberos.cc
worker.cc
security_buffer.cc
C:Program Files (x86)Microsoft Visual Studio 12.0VCincludexlocale(337): wa
rning C4530: C++ exception handler used, but unwind semantics are not enabled.
Specify /EHsc (..libwin32wrapperssecurity_buffer.cc) [D:projectsprojects
closure-testnode_modulesmongoosenode_modulesmongodbnode_moduleskerberosb
uildkerberos.vcxproj]
security_buffer_descriptor.cc
C:Program Files (x86)Microsoft Visual Studio 12.0VCincludexlocale(337): wa
rning C4530: C++ exception handler used, but unwind semantics are not enabled.
Specify /EHsc (..libwin32wrapperssecurity_buffer_descriptor.cc) [D:project
sprojectsclosure-testnode_modulesmongoosenode_modulesmongodbnode_modules
kerberosbuildkerberos.vcxproj]
security_context.cc
security_credentials.cc
C:Program Files (x86)Microsoft Visual Studio 12.0VCincludexlocale(337): wa
rning C4530: C++ exception handler used, but unwind semantics are not enabled.
Specify /EHsc (..libwin32wrapperssecurity_credentials.cc) [D:projectsproj
ectsclosure-testnode_modulesmongoosenode_modulesmongodbnode_moduleskerbe
rosbuildkerberos.vcxproj]
C:Program Files (x86)Microsoft Visual Studio 12.0VCincludexlocale(337): wa
rning C4530: C++ exception handler used, but unwind semantics are not enabled.
Specify /EHsc (..libwin32wrapperssecurity_context.cc) [D:projectsprojects
closure-testnode_modulesmongoosenode_modulesmongodbnode_moduleskerberos
buildkerberos.vcxproj]
base64.c
kerberos_sspi.c
Creating library D:projectsprojectsclosure-testnode_modulesmongoosen
ode_modulesmongodbnode_moduleskerberosbuildReleasekerberos.lib and obje
ct D:projectsprojectsclosure-testnode_modulesmongoosenode_modulesmongo
dbnode_moduleskerberosbuildReleasekerberos.exp
Generating code
Finished generating code
kerberos.vcxproj -> D:projectsprojectsclosure-testnode_modulesmongoosen
ode_modulesmongodbnode_moduleskerberosbuildRelease\kerberos.node
mongoose@3.8.25 node_modulesmongoose
├── regexp-clone@0.0.1
├── muri@0.3.1
├── sliced@0.0.5
├── hooks@0.2.1
├── mpath@0.1.1
├── mpromise@0.4.3
├── ms@0.1.0
├── mquery@0.8.0 (debug@0.7.4)
└── mongodb@1.4.32 (readable-stream@1.0.33, kerberos@0.0.9)