在windows上安装mongoose

时间:2015-05-12 04:28:06

标签: windows node.js mongoose npm

我试图通过

在Windows 7机器上安装mongoose
npm install mongoose

但无法让它发挥作用。 错误是:

kerberos.vcxproj -> D:\dan\revert\node_modules\mongoose\node_modules\mongodb\node_modules\mongodb-core\node_modules\kerberos\build\Release\\kerberos.node

> bson-ext@0.1.6 install D:\dan\revert\node_modules\mongoose\node_modules\mongodb\node_modules\mongodb-core\node_modules\bson\node_modules\bson-ext
> ./node_modules/node-pre-gyp/bin/node-pre-gyp.js install --fallback-to-build

'.' is not recognized as an internal or external command,
operable program or batch file.
npm WARN optional dep failed, continuing bson-ext@0.1.6
npm ERR! peerinvalid The package mongoose does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer node-restful@0.1.18 wants mongoose@~3

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "mongoose"
npm ERR! cwd D:\dan\revert
npm ERR! node -v v0.10.34
npm ERR! npm -v 1.4.28
npm ERR! code EPEERINVALID
npm ERR! not ok code 0

我试过了:

  1. npm install -g node-gyp
  2. npm卸载mongodb --save npm install mongoose --save
  3. 欢迎任何想法

2 个答案:

答案 0 :(得分:1)

I would have left a comment, but I don't have enough reputation points.

I agree with @user645715, try a lower version of mongoose. Or install the latest node & npm. Look into Node Version Manager (NVM) for easy switching between versions of node.

On windows to get node-gyp to build you need to install Python 2.7 and have the visual studio build components. Just install Visual Studio Express. This is all in the node-gyp documentation: https://www.npmjs.com/package/node-gyp

答案 1 :(得分:0)

npm install --save mongoose@3.8.35