因此,我尝试启动我的节点应用程序,但我的 MongoDB 安装出现了一些错误。
以下是我的开发环境的规格:
节点 => 0.10.33(从nodejs.org安装)
npm => 1.4.28(从nodejs.org安装)
git => 2.1.3(自制)
mongodb => 2.6.5(自制)
如果有什么不同的话,我也在使用平均堆栈骨架 https://github.com/vkarpov15/mean-stack-skeleton作为教程的一部分。
简而言之,当我尝试使用运行我的节点应用程序时$ node app.js
,我得到以下反馈:
USER$ npm install mongoose
> [email protected] /cdn-cgi/l/email-protection install /Users/USER/APP/node_modules/mongoose/node_modules/mongodb/node_modules/kerberos
> (node-gyp rebuild 2> builderror.log) || (exit 0)
CXX(target) Release/obj.target/kerberos/lib/kerberos.o
CXX(target) Release/obj.target/kerberos/lib/worker.o
CC(target) Release/obj.target/kerberos/lib/kerberosgss.o
CC(target) Release/obj.target/kerberos/lib/base64.o
CXX(target) Release/obj.target/kerberos/lib/kerberos_context.o
SOLINK_MODULE(target) Release/kerberos.node
SOLINK_MODULE(target) Release/kerberos.node: Finished
> [email protected] /cdn-cgi/l/email-protection install /Users/USER/APP/node_modules/mongoose/node_modules/mongodb/node_modules/bson
> (node-gyp rebuild 2> builderror.log) || (exit 0)
CXX(target) Release/obj.target/bson/ext/bson.o
SOLINK_MODULE(target) Release/bson.node
SOLINK_MODULE(target) Release/bson.node: Finished
[email protected] /cdn-cgi/l/email-protection node_modules/mongoose
├── reg[email protected] /cdn-cgi/l/email-protection
├── [email protected] /cdn-cgi/l/email-protection
├── [email protected] /cdn-cgi/l/email-protection
├── [email protected] /cdn-cgi/l/email-protection
├── [email protected] /cdn-cgi/l/email-protection
├── [email protected] /cdn-cgi/l/email-protection
├── [email protected] /cdn-cgi/l/email-protection
├── [email protected] /cdn-cgi/l/email-protection ([email protected] /cdn-cgi/l/email-protection)
└── mongo[email protected] /cdn-cgi/l/email-protection ([email protected] /cdn-cgi/l/email-protection, [email protected] /cdn-cgi/l/email-protection, [email protected] /cdn-cgi/l/email-protection)
我检查了builderror.log
两个文件kerberos
and bson
模块。然而,两者都是空的。
我发现的一些研究表明这个问题可能是因为我的node-gyp
安装没有对应的binding.gyp
file.
也尝试过跑步$ node-gyp configure
在我的 Node.js 项目文件夹中。这是我收到的错误:
gyp: binding.gyp not found (cwd: /Users/USER/APP) 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 (/usr/local/lib/node_modules/node-gyp/lib/configure.js:343:16)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:810:12)
gyp ERR! System Darwin 12.5.0
gyp ERR! command "node" "/usr/local/bin/node-gyp" "configure"
gyp ERR! cwd /Users/USER/APP
gyp ERR! node -v v0.10.33
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok
有什么想法为什么我会遇到这些问题吗?
编辑:在我的中设置端口后app.js
文件将端口设置为 Express 服务器正在侦听的端口(废话),我收到更多反馈表明我正在使用 Mongoose 3.9.4,这是最新的不稳定版本mongoose
。所以我在我的中将模块设置为 3.8.18package.json
并尝试重新安装该模块。我收到了同样的错误。不过,不稳定的发布反馈现在已经消失了。