Win 10 npm 安装mongodb究竟成功没有呢?
发布于 7 年前 作者 pronan 6922 次浏览 最后一次编辑是 6 年前 来自 问答

使用命令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. \

kerberos@0.0.17 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 mongodb@2.1.0 C:\Users\Administrator\AppData\Roaming\npm\node_modules\mongodb ├── es6-promise@3.0.2 ├── readable-stream@1.0.31 (inherits@2.0.1, string_decoder@0.10.31, isarray@0.0.1, core-util-is@1.0.2) ├── kerberos@0.0.17 (nan@2.0.9) └── mongodb-core@1.2.26 (bson@0.4.20)

C:\Users\Administrator>

4 回复

这个为什么要全局安装?

@XGHeaven 全局安装没啥吧?

@pronan 全局安装就不要require了

win下就直接下个EXE装了算了。。。 自豪地采用 CNodeJS ionic

回到顶部