使用命令npm install -g mongodb安装的, 1.提示需要安装kerberos, 然后自动安装, 似乎是由于Python的版本不对而安装失败 2.自动安装mongodb, 成功了. 3.结束后在C:\Users\Administrator\AppData\Roaming\npm\node_modules里面能看到mongodb, 而且mongodb的node_module里面也有kerberos. 之后require(‘mongodb’)也没有报错. 但不太确定是否成功.
这是安装记录:
C:\Users\Administrator>npm install -g mongodb npm WARN peerDependencies The peer dependency kerberos@~0.0 included from mongodb-core will no npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly. \
[email protected] install C:\Users\Administrator\AppData\Roaming\npm\node_modules\mongodb\node_modules\kerberos (node-gyp rebuild) || (exit 0)
C:\Users\Administrator\AppData\Roaming\npm\node_modules\mongodb\node_modules\kerberos>if not defined npm_config_node_gyp (node “C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\…\node_modules\node-gyp\bin\node-gyp.js” rebuild ) else (node rebuild ) gyp ERR! configure error gyp ERR! stack Error: Python executable “python” is v3.4.3, which is not supported by gyp. gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0. gyp ERR! stack at failPythonVersion (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:121:14) gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:110:9 gyp ERR! stack at ChildProcess.exithandler (child_process.js:194:7) gyp ERR! stack at emitTwo (events.js:87:13) gyp ERR! stack at ChildProcess.emit (events.js:172:7) gyp ERR! stack at maybeClose (internal/child_process.js:818:16) gyp ERR! stack at Socket.<anonymous> (internal/child_process.js:319:11) gyp ERR! stack at emitOne (events.js:77:13) gyp ERR! stack at Socket.emit (events.js:169:7) gyp ERR! stack at Pipe._onclose (net.js:469:12) gyp ERR! System Windows_NT 10.0.10240 gyp ERR! command “C:\Program Files\nodejs\node.exe” “C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js” "rebuild" gyp ERR! cwd C:\Users\Administrator\AppData\Roaming\npm\node_modules\mongodb\node_modules\kerberos gyp ERR! node -v v4.2.2 gyp ERR! node-gyp -v v3.0.3 gyp ERR! not ok [email protected] C:\Users\Administrator\AppData\Roaming\npm\node_modules\mongodb ├── [email protected] ├── [email protected] ([email protected], [email protected], [email protected], [email protected]) ├── [email protected] ([email protected]) └── [email protected] ([email protected])
C:\Users\Administrator>